aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-02-09 17:32:27 -0800
committerThomas White <taw@physics.org>2013-02-09 17:32:27 -0800
commit463ab1b598c3ca8a120989f8a26c480a67b66268 (patch)
tree3d514c274a6fbcea2d70ed202d687b17a4a0c023 /libcrystfel
parentac00ba6fabcd5fa64b73d79b5a6b783e8763238f (diff)
uncenter_cell: Free transformation if it's not needed by the caller
Diffstat (limited to 'libcrystfel')
-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;
}