aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-05-11 14:06:08 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:26 +0100
commitad1e432cc4c172dd8335ba02f8a2688e2cdb0a0e (patch)
tree385de13e0ecf6a92007aaba39cffc34f5ada7ef2 /src/detector.c
parentfc7908049360ff88baea23ca0a879779c66018d6 (diff)
Avoid doing strdup(NULL)
Diffstat (limited to 'src/detector.c')
-rw-r--r--src/detector.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/detector.c b/src/detector.c
index 4d60f66e..5c1db570 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -782,7 +782,11 @@ struct detector *copy_geom(const struct detector *in)
out = malloc(sizeof(struct detector));
memcpy(out, in, sizeof(struct detector));
- out->mask = strdup(in->mask);
+ if ( in->mask != NULL ) {
+ out->mask = strdup(in->mask);
+ } else {
+ out->mask = NULL; /* = in->mask */
+ }
out->panels = malloc(out->n_panels * sizeof(struct panel));
memcpy(out->panels, in->panels, out->n_panels * sizeof(struct panel));