examples/bond: check mbuf allocation
authorRadu Nicolau <radu.nicolau@intel.com>
Wed, 24 Jan 2018 13:16:46 +0000 (13:16 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 1 Feb 2018 00:20:37 +0000 (01:20 +0100)
Coverity issue: 257008
Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
examples/bond/main.c

index b8efcaf..455f108 100644 (file)
@@ -441,6 +441,11 @@ static void cmd_obj_send_parsed(void *parsed_result,
                                (BOND_IP_3 << 16) | (BOND_IP_4 << 24);
 
        created_pkt = rte_pktmbuf_alloc(mbuf_pool);
+       if (created_pkt == NULL) {
+               cmdline_printf(cl, "Failed to allocate mbuf\n");
+               return;
+       }
+
        pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr);
        created_pkt->data_len = pkt_size;
        created_pkt->pkt_len = pkt_size;