From e935ba72211a2fb6cf90cf65558b77b0ce3bfa12 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 10 Dec 2018 09:26:34 +0000 Subject: [PATCH] fixed a bug in alloc_numeric_array() that allocated the extra 'len' bytes instead of a single extra 'unit' bytes --- lib/obj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/obj.c b/lib/obj.c index a67fb6c..2441e44 100644 --- a/lib/obj.c +++ b/lib/obj.c @@ -139,7 +139,7 @@ static HCL_INLINE hcl_oop_t alloc_numeric_array (hcl_t* hcl, int brand, const vo xbytes = len * unit; /* 'extra' indicates an extra unit to append at the end. * it's useful to store a string with a terminating null */ - nbytes = extra? xbytes + len: xbytes; + nbytes = extra? xbytes + unit: xbytes; nbytes_aligned = HCL_ALIGN(nbytes, HCL_SIZEOF(hcl_oop_t)); /* TODO: check overflow in size calculation*/