app/test: fix memory corruption in reentrancy autotest
authorOlivier Matz <olivier.matz@6wind.com>
Mon, 11 Apr 2016 09:33:23 +0000 (11:33 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 11 Apr 2016 10:13:16 +0000 (12:13 +0200)
commit411c22d4e09d09f6584fb70145e60bebf723c197
tree3275a32ef01043a00c83b1e6f7bd93161ef00b41
parent8a78fa6115e24a42495d19365d73b8c69c68d54d
app/test: fix memory corruption in reentrancy autotest

The mempool element size is set to 0, but 4 bytes are written in
my_obj_init():

  uint32_t *objnum = obj;
  memset(obj, 0, mp->elt_size);
  *objnum = i;

Change the MEMPOOL_ELT_SIZE constant to sizeof(uint32_t). This fixes
memory corruptions since we were writing outside of the object
boundaries.

Fixes: 104a92bd026 ("app: add reentrancy tests")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
app/test/test_func_reentrancy.c