From ef41d78fe460d939dc180c97d95d6ee880a7e3e5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 12 Jun 2010 22:52:08 -0700 Subject: calibrate-detector: Fix memory errors --- src/calibrate-detector.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/calibrate-detector.c b/src/calibrate-detector.c index 127e2ecd..4c4f5c33 100644 --- a/src/calibrate-detector.c +++ b/src/calibrate-detector.c @@ -76,6 +76,7 @@ static void *process_image(void *pargsv) image.features = NULL; image.data = NULL; + image.flags = NULL; image.indexed_cell = NULL; image.id = pargs->id; image.filename = pargs->filename; @@ -131,8 +132,13 @@ static void *process_image(void *pargsv) for ( i=0; ix; - int yp = f->y; + int xp, yp; + + /* This is not an error. */ + if ( f == NULL ) continue; + + xp = f->x; + yp = f->y; for ( x=-INTEGRATION_RADIUS; x<+INTEGRATION_RADIUS; x++ ) { for ( y=-INTEGRATION_RADIUS; y<+INTEGRATION_RADIUS; y++ ) { @@ -153,7 +159,7 @@ static void *process_image(void *pargsv) out: free(image.data); - free(image.flags); + if ( image.flags != NULL ) free(image.flags); hdfile_close(hdfile); return NULL; -- cgit v1.2.3