net/pcap: fix memory leak
authorQi Zhang <qi.z.zhang@intel.com>
Wed, 30 Jan 2019 01:08:54 +0000 (09:08 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 7 Feb 2019 12:28:53 +0000 (13:28 +0100)
Fix potential memory leak due to kvlist not be freed.

Fixes: 0d0dd2d9d8ff ("net/pcap: enable data path for secondary process")
Cc: stable@dpdk.org
Reported-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/pcap/rte_eth_pcap.c

index 9fd9327..65bbd7e 100644 (file)
@@ -1258,7 +1258,8 @@ create_eth:
                if (pp == NULL) {
                        PMD_LOG(ERR,
                                "Failed to allocate memory for process private");
-                       return -1;
+                       ret = -1;
+                       goto free_kvlist;
                }
 
                eth_dev->dev_ops = &ops;
@@ -1281,7 +1282,7 @@ create_eth:
                        eth_dev->tx_pkt_burst = eth_pcap_tx;
 
                rte_eth_dev_probing_finish(eth_dev);
-               return 0;
+               goto free_kvlist;
        }
 
        ret = eth_from_pcaps(dev, &pcaps, pcaps.num_of_queue, &dumpers,