aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-11-13 15:40:52 +0100
committerThomas White <taw@physics.org>2015-11-13 15:40:52 +0100
commit20ebfdbc1780a0d631ce9522291f82d4300b26d8 (patch)
treefdf7fd2dbceafb51c5b8cb56fd8d9f0e6d48b62f /src
parentc92244e212ea7c678ea6d070a0bc79f48bcbf6e2 (diff)
Avoid NULL dereference in some scenarios when there is no bad pixel mask
Diffstat (limited to 'src')
-rw-r--r--src/geoptimiser.c1
-rw-r--r--src/hdfsee-render.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/geoptimiser.c b/src/geoptimiser.c
index 4144bba2..dda53adc 100644
--- a/src/geoptimiser.c
+++ b/src/geoptimiser.c
@@ -2261,6 +2261,7 @@ static int save_data_to_png(char *filename, struct enhanced_det *edet,
im.det = edet->det;
im.width = edet->width;
im.height = edet->height;
+ im.bad = NULL;
im.dp = malloc(edet->det->n_panels*sizeof(float *));
if ( im.dp == NULL ) {
ERROR("Failed to allocate data\n");
diff --git a/src/hdfsee-render.c b/src/hdfsee-render.c
index a64832a0..358847a4 100644
--- a/src/hdfsee-render.c
+++ b/src/hdfsee-render.c
@@ -88,7 +88,8 @@ static float *get_binned_panel(struct image *image, int binning,
v = image->dp[pi][fs+ss*fw];
total += v;
- if ( image->bad[pi][fs+ss*fw] ) bad = 1;
+ if ( (image->bad != NULL)
+ && (image->bad[pi][fs+ss*fw]) ) bad = 1;
}
}