From 364fc0daf66cde1d63abe18f91178596b97a1f04 Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Wed, 14 Dec 2016 10:02:49 +0900 Subject: [PATCH] Fixed redundant caluclation. --- src/unpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }