aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-03-15 10:41:49 +0100
committerThomas White <taw@physics.org>2019-03-15 10:41:59 +0100
commitc8d2d898f09179e647a24cbebbd5d2d06fd6487f (patch)
tree36e452ff5d7ab03f40024074068fd86db2ac69b0
parent75d8d522008429c4973c28a2c5a770a581f5efd5 (diff)
Set proper size for blank data
-rw-r--r--src/im-zmq.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/im-zmq.c b/src/im-zmq.c
index ba3d58e5..f5e2793d 100644
--- a/src/im-zmq.c
+++ b/src/im-zmq.c
@@ -406,7 +406,7 @@ static double *find_msgpack_data(msgpack_object *obj, int *width, int *height)
}
-static double *zero_array(struct detector *det)
+static double *zero_array(struct detector *det, int *dw, int *dh)
{
int max_fs = 0;
int max_ss = 0;
@@ -423,6 +423,8 @@ static double *zero_array(struct detector *det)
}
data = calloc((max_fs+1)*(max_ss+1), sizeof(double));
+ *dw = max_fs+1;
+ *dh = max_ss+1;
return data;
}
@@ -465,7 +467,7 @@ int unpack_msgpack_data(msgpack_object *obj, struct image *image,
return 1;
}
} else {
- data = zero_array(image->det);
+ data = zero_array(image->det, &data_width, &data_height);
}
if ( unpack_slab(image, data, data_width, data_height) ) {