Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks. #11

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/EvaluateField/evaluateField.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ int main( int argc, char *argv[] )
outputVolume(volume, args.outputPath, output_type, signed_flag, real_min, real_max,
args.command);

delete theSplines;

delete_volume(volume);
if (args.use_mask)
delete_volume(mask_volume);

return(0);
}

1 change: 1 addition & 0 deletions src/ExtractTag/extracttag.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,7 @@ long int gen_seed(void)
res = res - x * divisor;
divisor /= 10;
}

return res;
}

Expand Down
9 changes: 8 additions & 1 deletion src/SplineSmooth/fieldIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,22 @@ VIO_Status inputCompactField(VIO_STR filename, Spline **splines,
if( mni_skip_expected_character( file, (char) ';' ) != VIO_OK )
return( VIO_ERROR );

delete_string(version_name);
delete_string(line);
/* read next field */
status = mni_input_string( file, &line, (char) '=', (char) 0 );
if( status != VIO_OK ||
mni_skip_expected_character( file, (char) '=' ) != VIO_OK )
return( status );
{
delete_string( line );
return( status );
}
}

/* --- read the type of field */
if(!equal_strings( line, TYPE_STRING ))
return(VIO_ERROR);
delete_string( line );

if( mni_input_string( file, &type_name, (char) ';', (char) 0 ) != VIO_OK )
{
Expand Down Expand Up @@ -430,6 +436,7 @@ loadEmptyFloatVolume(const MString filename, nc_type *data_type, VIO_BOOL *signe

*data_type = get_volume_nc_data_type(volume, signed_flag);
delete_volume_input( &input_info);
delete_volume(volume);

// open this time using float type
if (start_volume_input((char *)(const char *)filename, VIO_N_DIMENSIONS,
Expand Down
10 changes: 9 additions & 1 deletion src/VolumeHist/minchist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,15 @@ int main( int argc, char *argv[] )
}
fclose(fp);
}


delete [] class_min;
delete [] class_max;
delete_volume(volume);
if (args.mask_flag)
delete_volume(mask_volume);
for(i = 0; i < n_histograms; i++)
delete histogram[i];
free(histogram);
return(0);
}

Expand Down
3 changes: 3 additions & 0 deletions src/VolumeStats/volumeStats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ main(int argc, char *argv[])
}
}

if (mask)
delete_volume(mask);

if (voxels)
delete voxels;

Expand Down