File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -720,7 +720,8 @@ int gvl_isosurf_calc(geovol *gvol)
720720 }
721721 }
722722
723- /* TODO: G_free() dbuff and need_update ??? */
723+ G_free (dbuff );
724+ G_free (need_update );
724725
725726 return (1 );
726727}
@@ -775,20 +776,23 @@ unsigned char gvl_read_char(int pos, const unsigned char *data)
775776 */
776777void gvl_align_data (int pos , unsigned char * * data )
777778{
778- unsigned char * p = * data ;
779-
779+ if (pos <= 0 ) {
780+ if (* data ) {
781+ G_free (* data );
782+ * data = NULL ;
783+ }
784+ return ;
785+ }
780786 /* realloc memory to fit in data length */
781- p = (unsigned char * )G_realloc (p , sizeof (unsigned char ) *
782- pos ); /* G_fatal_error */
787+ unsigned char * p ;
788+ p = (unsigned char * )G_realloc (* data , sizeof (unsigned char ) *
789+ pos ); /* G_fatal_error */
783790 if (!p ) {
784791 return ;
785792 }
786793
787794 G_debug (3 , "gvl_align_data(): reallocate memory finally to : %d B" , pos );
788795
789- if (pos == 0 )
790- p = NULL ;
791-
792796 * data = p ;
793797
794798 return ;
You can’t perform that action at this time.
0 commit comments