aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-07-31 09:56:49 +0200
committerThomas White <taw@physics.org>2019-07-31 09:56:49 +0200
commit9dc76221b9cdb0f72110dbf83893177f23f20634 (patch)
tree5e9868195ef207d58add5a6ffeef63b382b10bda /libcrystfel/src
parent91a21f4de4d4b04122a5583103a67e6fb15f4ff2 (diff)
copy_geom: Fix order of operations
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/detector.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 9617788d..ac33bbc0 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -1800,15 +1800,15 @@ struct detector *copy_geom(const struct detector *in)
out = malloc(sizeof(struct detector));
memcpy(out, in, sizeof(struct detector));
+ /* Copy all fields */
+ *out = *in;
+
out->panels = malloc(out->n_panels * sizeof(struct panel));
memcpy(out->panels, in->panels, out->n_panels * sizeof(struct panel));
out->bad = malloc(out->n_bad * sizeof(struct badregion));
memcpy(out->bad, in->bad, out->n_bad * sizeof(struct badregion));
- /* Copy all fields */
- *out = *in;
-
/* Copy the panels */
for ( i=0; i<out->n_panels; i++ ) {