From 17f331d526fa68e01e44c55f90a00bb7b9a3d637 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 13 Apr 2011 22:41:29 +0200 Subject: Tidy up various memory leaks --- src/indexamajig.c | 6 ++++-- src/mosflm.c | 10 +++------- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/indexamajig.c b/src/indexamajig.c index a7565d01..ba921e0d 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -351,6 +351,7 @@ static void process_image(void *pp, int cookie) /* Only free cell if found */ cell_free(image.indexed_cell); + reflist_free(image.reflections); free(image.data); if ( image.flags != NULL ) free(image.flags); image_feature_list_free(image.features); @@ -383,6 +384,7 @@ static void *get_image(void *qp) rval = fgets(line, 1023, qargs->fh); if ( rval == NULL ) { free(pargs); + free(line); return NULL; } chomp(line); @@ -877,8 +879,8 @@ int main(int argc, char *argv[]) free(indm); free(ipriv); free(prefix); - free(det->panels); - free(det); + free_detector_geometry(det); + free(beam); free(element); cell_free(cell); if ( fh != stdin ) fclose(fh); diff --git a/src/mosflm.c b/src/mosflm.c index b4906921..9ccbf0d5 100644 --- a/src/mosflm.c +++ b/src/mosflm.c @@ -505,7 +505,6 @@ static int mosflm_readable(struct image *image, struct mosflm_data *mosflm) void run_mosflm(struct image *image, UnitCell *cell) { - int fail; struct mosflm_data *mosflm; unsigned int opts; int status; @@ -531,6 +530,7 @@ void run_mosflm(struct image *image, UnitCell *cell) mosflm->pid = forkpty(&mosflm->pty, NULL, NULL, NULL); if ( mosflm->pid == -1 ) { ERROR("Failed to fork for MOSFLM\n"); + free(mosflm); return; } if ( mosflm->pid == 0 ) { @@ -590,12 +590,8 @@ void run_mosflm(struct image *image, UnitCell *cell) free(mosflm->rbuffer); waitpid(mosflm->pid, &status, 0); - /* Read the mosflm NEWMAT file and set cell candidate * - * Existence of this file means possible success. Pretty shady. */ - fail = read_newmat(mosflm->newmatfile, image); - if ( fail ) { - return; - } + /* Read the mosflm NEWMAT file and set cell candidate if found */ + read_newmat(mosflm->newmatfile, image); free(mosflm); } -- cgit v1.2.3