aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-10-22 17:50:37 +0200
committerThomas White <taw@physics.org>2014-10-23 17:02:32 +0200
commit1a37de5cce5c2df83e37fb189409659299594b1b (patch)
treedeb3e7c3b8b661c07aa2a4a4a663c97081d63b05 /libcrystfel/src
parent8bdd03533aefabfe13259eb6e9b585420b4ed984 (diff)
Fix a load of memory leaks
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/detector.c1
-rw-r--r--libcrystfel/src/dirax.c2
-rw-r--r--libcrystfel/src/events.c11
-rw-r--r--libcrystfel/src/events.h2
-rw-r--r--libcrystfel/src/integration.c1
-rw-r--r--libcrystfel/src/stream.c3
6 files changed, 12 insertions, 8 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 4a202f2e..683fdd49 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -1333,6 +1333,7 @@ void free_detector_geometry(struct detector *det)
for ( i=0; i<det->n_panels; i++ ) {
free(det->panels[i].clen_from);
+ free_dim_structure(det->panels[i].dim_structure);
}
free(det->panels);
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index 0a137784..a48cf2e8 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -255,6 +255,8 @@ static void dirax_parseline(const char *line, struct image *image,
dirax->success = 1;
}
+ cell_free(cell);
+
return;
}
diff --git a/libcrystfel/src/events.c b/libcrystfel/src/events.c
index 6e52f6cd..19d69b81 100644
--- a/libcrystfel/src/events.c
+++ b/libcrystfel/src/events.c
@@ -238,12 +238,13 @@ void free_event_list(struct event_list *el)
void free_filename_plus_event(struct filename_plus_event *fpe)
{
-
free(fpe->filename);
if ( fpe->ev != NULL ) {
free_event(fpe->ev);
}
+
+ free(fpe);
}
@@ -622,12 +623,8 @@ struct dim_structure *default_dim_structure()
void free_dim_structure(struct dim_structure *hsd)
{
- int di;
-
- for ( di=0; di<hsd->num_dims; di++ ) {
- free (hsd->dims);
- free (hsd);
- }
+ free(hsd->dims);
+ free(hsd);
}
diff --git a/libcrystfel/src/events.h b/libcrystfel/src/events.h
index e6e5d840..ee47c5a5 100644
--- a/libcrystfel/src/events.h
+++ b/libcrystfel/src/events.h
@@ -103,6 +103,6 @@ extern int set_dim_structure_entry(struct dim_structure *hsd,
const char *string_dim,
const char *val_string);
extern void free_dim_structure_entry(struct dim_structure *hsd);
-
+extern void free_dim_structure(struct dim_structure *hsd);
#endif /* EVENTS_H */
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index 34bde83a..55adf287 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -641,6 +641,7 @@ static void delete_box(struct intcontext *ic, struct peak_box *bx)
}
free(bx->bm);
+ gsl_matrix_free(bx->bgm);
memmove(&ic->boxes[i], &ic->boxes[i+1],
(ic->n_boxes-i-1)*sizeof(struct peak_box));
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index 519a1ca9..c1b32a4f 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -1304,6 +1304,9 @@ void write_geometry_file(Stream *st, const char *geom_filename) {
rval = fgets(line, 1023, geom_fh);
fputs(line, st->fh);
} while ( rval != NULL );
+
+ fclose(geom_fh);
+
fprintf(st->fh, GEOM_END_MARKER"\n");
fflush(st->fh);
}