diff --git a/src/unpack.c b/src/unpack.c index b7b6ecd1..e7763864 100644 --- a/src/unpack.c +++ b/src/unpack.c @@ -197,7 +197,7 @@ static inline int template_callback_array(unpack_user* u, unsigned int n, msgpac // integer overflow return MSGPACK_UNPACK_NOMEM_ERROR; } - o->via.array.ptr = (msgpack_object*)msgpack_zone_malloc(u->z, n*sizeof(msgpack_object)); + o->via.array.ptr = (msgpack_object*)msgpack_zone_malloc(u->z, size); if(o->via.array.ptr == NULL) { return MSGPACK_UNPACK_NOMEM_ERROR; } return 0; }