aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-01-25 09:31:34 +0100
committerThomas White <taw@physics.org>2019-01-28 14:55:31 +0100
commit9b1d07ba6ed79d2b32b1e8fa92bd93628f66b1c0 (patch)
tree12f43425f32555c4c0145b5fba1465302d2398d3 /libcrystfel
parent9d7a9223c780ff9ce75fa4ccac2321a011ae640b (diff)
partialator: Fix multiple memory leaks
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/reflist.c1
-rw-r--r--libcrystfel/src/stream.c12
-rw-r--r--libcrystfel/src/stream.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/libcrystfel/src/reflist.c b/libcrystfel/src/reflist.c
index f1d759ea..9c8a6a14 100644
--- a/libcrystfel/src/reflist.c
+++ b/libcrystfel/src/reflist.c
@@ -233,6 +233,7 @@ void reflist_free(RefList *list)
if ( list->head != NULL ) {
recursive_free(list->head);
} /* else empty list */
+ if ( list->notes != NULL ) free(list->notes);
free(list);
}
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index bcd2627e..66b3b657 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -1131,6 +1131,18 @@ static void read_crystal(Stream *st, struct image *image, StreamReadFlags srf)
}
+void free_stuff_from_stream(struct stuff_from_stream *sfs)
+{
+ int i;
+ if ( sfs == NULL ) return;
+ for ( i=0; i<sfs->n_fields; i++ ) {
+ free(sfs->fields[i]);
+ }
+ free(sfs->fields);
+ free(sfs);
+}
+
+
static int read_and_store_field(struct image *image, const char *line)
{
char **new_fields;
diff --git a/libcrystfel/src/stream.h b/libcrystfel/src/stream.h
index a8e3e2ee..bd7aa690 100644
--- a/libcrystfel/src/stream.h
+++ b/libcrystfel/src/stream.h
@@ -106,6 +106,8 @@ extern Stream *open_stream_fd_for_write(int fd);
extern int get_stream_fd(Stream *st);
extern void close_stream(Stream *st);
+extern void free_stuff_from_stream(struct stuff_from_stream *sfs);
+
extern int read_chunk(Stream *st, struct image *image);
extern int read_chunk_2(Stream *st, struct image *image,
StreamReadFlags srf);