aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-14 18:09:45 -0700
committerThomas White <taw@physics.org>2012-02-22 15:26:50 +0100
commit91e18f00bf8fdbc019cbf60648715ef70a09366c (patch)
treeebb899a80e640cff6c510f00787da64edcd979cb /src
parent72719468f58acca3237999c1f3888e0516054155 (diff)
Fix more memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/detector.c16
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;
}