The function malloc() could return NULL, the return value
need to be checked.
Fixes: 6f63858e55e6 ("mem: prevent preallocated pages from being freed")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
needed = num_pages - num_pages_alloc;
pages = malloc(sizeof(*pages) * needed);
+ if (pages == NULL) {
+ RTE_LOG(ERR, EAL, "Failed to malloc pages\n");
+ return -1;
+ }
/* do not request exact number of pages */
cur_pages = eal_memalloc_alloc_seg_bulk(pages,