aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/image.c2
-rw-r--r--libcrystfel/src/stream.c1
-rw-r--r--src/process_image.c8
3 files changed, 3 insertions, 8 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 478bb2d1..3efa2954 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -334,9 +334,9 @@ static double get_length(struct image *image, const char *from)
units = 1.0e-3;
} else {
units = unit_string_to_unit(sp+1);
+ sp[0] = '\0';
}
- sp[0] = '\0';
val = get_value(image, fromcpy);
free(fromcpy);
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index 1acddb70..ec49ec9d 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -1236,6 +1236,7 @@ Stream *stream_open_fd_for_write(int fd)
void stream_write_target_cell(Stream *st, const UnitCell *cell)
{
+ if ( cell == NULL ) return;
fprintf(st->fh, STREAM_CELL_START_MARKER"\n");
write_cell(cell, st->fh);
fprintf(st->fh, "; Please note: this is the target unit cell.\n");
diff --git a/src/process_image.c b/src/process_image.c
index d87f2cff..bec73a08 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -439,16 +439,10 @@ out:
sb_shared->n_hadcrystals += any_crystals;
pthread_mutex_unlock(&sb_shared->totals_lock);
- for ( i=0; i<image->n_crystals; i++ ) {
- cell_free(crystal_get_cell(image->crystals[i]));
- reflist_free(crystal_get_reflections(image->crystals[i]));
- crystal_free(image->crystals[i]);
- }
- free(image->crystals);
-
/* Free spectrum only if we generated it for this image */
if ( iargs->spectrum == NULL ) {
spectrum_free(image->spectrum);
+ image->spectrum = NULL;
}
/* Free image (including detgeom) */