From: Tetsuya Mukawa Date: Fri, 12 Jun 2015 02:54:00 +0000 (+0900) Subject: app/test: fix crash after mbuf allocation failure X-Git-Tag: spdx-start~9007 X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=aa61307afcbd5df7b960dec18b321181680a4232 app/test: fix crash after mbuf allocation failure The patch fixes potential null pointer accesses in test_mbuf. If 'm[i]' is null, stop accessing it. Signed-off-by: Tetsuya Mukawa --- diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 5e8a377de0..5d13b374d9 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -594,6 +594,7 @@ test_pktmbuf_pool_ptr(void) if (m[i] == NULL) { printf("rte_pktmbuf_alloc() failed (%u)\n", i); ret = -1; + break; } m[i]->data_off += 64; } @@ -613,6 +614,7 @@ test_pktmbuf_pool_ptr(void) if (m[i] == NULL) { printf("rte_pktmbuf_alloc() failed (%u)\n", i); ret = -1; + break; } if (m[i]->data_off != RTE_PKTMBUF_HEADROOM) { printf("invalid data_off\n");