aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-06-01 19:00:01 -0700
committerThomas White <taw@physics.org>2013-06-01 19:00:01 -0700
commit3104cf229230151e8ca158144952d474f4b61aa3 (patch)
tree265cf4fc702109fd3a2066fa306a8d12203a7340 /libcrystfel
parentc3ce11bc291eb890ec0061892534802e75e3c2c1 (diff)
Fix multiple small memory leaks
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/cell-utils.c11
-rw-r--r--libcrystfel/src/dirax.c2
-rw-r--r--libcrystfel/src/mosflm.c1
-rw-r--r--libcrystfel/src/stream.c6
4 files changed, 19 insertions, 1 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 8b881178..12443c8d 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -526,6 +526,9 @@ UnitCell *match_cell(UnitCell *cell_in, UnitCell *template_in, int verbose,
&bsx, &bsy, &bsz,
&csx, &csy, &csz) ) {
ERROR("Couldn't get reciprocal cell for template.\n");
+ cell_free(template);
+ cell_free(cell);
+ tfn_free(uncentering);
return NULL;
}
@@ -545,6 +548,9 @@ UnitCell *match_cell(UnitCell *cell_in, UnitCell *template_in, int verbose,
&bsx, &bsy, &bsz,
&csx, &csy, &csz) ) {
ERROR("Couldn't get reciprocal cell.\n");
+ cell_free(template);
+ cell_free(cell);
+ tfn_free(uncentering);
return NULL;
}
@@ -715,9 +721,14 @@ UnitCell *match_cell(UnitCell *cell_in, UnitCell *template_in, int verbose,
cell_set_unique_axis(new_cell_trans,
cell_get_unique_axis(template_in));
+ cell_free(template);
+ tfn_free(uncentering);
+
return new_cell_trans;
} else {
+ cell_free(template);
+ tfn_free(uncentering);
return NULL;
}
}
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index 99e1accb..55e65fd1 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -242,6 +242,8 @@ static void dirax_parseline(const char *line, struct image *image,
dirax->done = 1;
dirax->success = 1;
}
+ cell_free(dirax->cur_cell);
+ dirax->cur_cell = NULL;
return;
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c
index c92ef343..162299b7 100644
--- a/libcrystfel/src/mosflm.c
+++ b/libcrystfel/src/mosflm.c
@@ -519,6 +519,7 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm)
symm = spacegroup_for_lattice(mosflm->mp->template);
snprintf(tmp, 255, "SYMM %s\n", symm);
+ free(symm);
mosflm_sendline(tmp, mosflm);
} else {
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index 5782bb82..91f644fa 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -203,11 +203,15 @@ void write_chunk(Stream *st, struct image *i, struct hdfile *hdfile,
int include_peaks, int include_reflections)
{
int j;
+ char *indexer;
fprintf(st->fh, CHUNK_START_MARKER"\n");
fprintf(st->fh, "Image filename: %s\n", i->filename);
- fprintf(st->fh, "indexed_by = %s\n", indexer_str(i->indexed_by));
+
+ indexer = indexer_str(i->indexed_by);
+ fprintf(st->fh, "indexed_by = %s\n", indexer);
+ free(indexer);
if ( i->det != NULL ) {