diff options
author | Thomas White <taw@physics.org> | 2010-06-12 22:52:08 -0700 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-06-12 22:52:08 -0700 |
commit | ef41d78fe460d939dc180c97d95d6ee880a7e3e5 (patch) | |
tree | fa61fd2e31b7b41ecfad8e3c11f28381150a59aa | |
parent | d57b55ca6d390656898439350c404a0447391eb9 (diff) |
calibrate-detector: Fix memory errors
-rw-r--r-- | src/calibrate-detector.c | 12 |
1 files changed, 9 insertions, 3 deletions
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; i<image_feature_count(image.features); i++ ) { struct imagefeature *f = image_get_feature(image.features, i); - int xp = f->x; - 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; |