aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-09-02 16:59:46 +0200
committerThomas White <taw@physics.org>2019-09-03 15:29:34 +0200
commitedf2e9869600d1779383317f4b2f661faff9a0e3 (patch)
tree7e64e4a0f1f5f4794093c746e0343e56aa5ef99e /libcrystfel
parentdc49ecdc2200f258d57f1f0970c7b01c0563da6e (diff)
get_detector_geometry_from_string: Fix memory leaks
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/detector.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 5055139f..201b9041 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -1270,12 +1270,16 @@ struct detector *get_detector_geometry_from_string(const char *string,
done = 1;
}
- if ( line[0] == ';' ) continue;
+ if ( line[0] == ';' ) {
+ free(line);
+ continue;
+ }
n1 = assplode(line, " \t", &bits, ASSPLODE_NONE);
if ( n1 < 3 ) {
for ( i=0; i<n1; i++ ) free(bits[i]);
free(bits);
+ free(line);
continue;
}
@@ -1289,6 +1293,7 @@ struct detector *get_detector_geometry_from_string(const char *string,
if ( bits[1][0] != '=' ) {
for ( i=0; i<n1; i++ ) free(bits[i]);
free(bits);
+ free(line);
continue;
}
@@ -1303,6 +1308,7 @@ struct detector *get_detector_geometry_from_string(const char *string,
free(bits);
for ( i=0; i<n2; i++ ) free(path[i]);
free(path);
+ free(line);
continue;
}
@@ -1334,6 +1340,7 @@ struct detector *get_detector_geometry_from_string(const char *string,
for ( i=0; i<n2; i++ ) free(path[i]);
free(bits);
free(path);
+ free(line);
} while ( !done );