VPP-152: mheap_alloc returns 0 when the requested heap size is too small 21/1621/2
authorPierre Pfister <ppfister@cisco.com>
Fri, 17 Jun 2016 12:30:02 +0000 (13:30 +0100)
committerDave Barach <openvpp@barachs.net>
Sun, 19 Jun 2016 13:31:59 +0000 (13:31 +0000)
commit889178c02a711fbc66d83415a88608f704fbc561
treeb17e56b0d9c803b09a2d75d86c7a24a4e3b7bfc9
parentf2868fcd2e2cb237854c1ff83b52b656e9027136
VPP-152: mheap_alloc returns 0 when the requested heap size is too small

mheap_alloc allocates memory_size bytes of memory and returns
a page-aligned memory space prefixed with a word-aligned
header of type mheap_t.

This header includes the actual usable space size, but
when the requested size is too small, the computed size
was incorrect (infinite).

mheap_alloc now returns 0 in such cases.

With help from Yoann Desmouceaux.

Change-Id: I00af63d573d6939aca53dbe7ff612b726bd8f0df
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
vppinfra/vppinfra/mheap.c
vppinfra/vppinfra/mheap.h