diff options
-rw-r--r-- | libcrystfel/src/detector.c | 6 |
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++ ) { |