aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/cell-utils.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 3ec9a9d6..ee51622b 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -424,14 +424,18 @@ UnitCell *uncenter_cell(UnitCell *in, UnitCellTransformation **t)
tt = uncentering_transformation(in, &new_centering, &new_latt);
if ( tt == NULL ) return NULL;
- if ( t != NULL ) *t = tt;
-
out = cell_transform(in, tt);
if ( out == NULL ) return NULL;
cell_set_lattice_type(out, new_latt);
cell_set_centering(out, new_centering);
+ if ( t != NULL ) {
+ *t = tt;
+ } else {
+ tfn_free(tt);
+ }
+
return out;
}