diff options
Diffstat (limited to 'src/detector.c')
-rw-r--r-- | src/detector.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/detector.c b/src/detector.c index db713137..55e9ec87 100644 --- a/src/detector.c +++ b/src/detector.c @@ -199,20 +199,32 @@ struct detector *get_detector_geometry(const char *filename) chomp(line); n1 = assplode(line, " \t", &bits, ASSPLODE_NONE); - if ( n1 < 3 ) continue; + if ( n1 < 3 ) { + for ( i=0; i<n1; i++ ) free(bits[i]); + free(bits); + continue; + } - if ( bits[1][0] != '=' ) continue; + if ( bits[1][0] != '=' ) { + for ( i=0; i<n1; i++ ) free(bits[i]); + free(bits); + continue; + } if ( strcmp(bits[0], "n_panels") == 0 ) { if ( det->n_panels != -1 ) { ERROR("Duplicate n_panels statement.\n"); fclose(fh); free(det); + for ( i=0; i<n1; i++ ) free(bits[i]); + free(bits); return NULL; } det->n_panels = atoi(bits[2]); det->panels = malloc(det->n_panels * sizeof(struct panel)); + for ( i=0; i<n1; i++ ) free(bits[i]); + free(bits); continue; } |