[dpdk-stable] patch 'net/pcap: fix memory leak in dumper open' has been queued to LTS release 16.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Nov 10 17:09:53 CET 2017


Hi,

FYI, your patch has been queued to LTS release 16.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/17. So please
shout if anyone has objections.

Thanks.

Kind regards,
Luca Boccassi

---
>From d224d370495209f3eb302370516a722a646ed949 Mon Sep 17 00:00:00 2001
From: Stefan Baranoff <sbaranoff at gmail.com>
Date: Sun, 5 Nov 2017 12:24:45 -0500
Subject: [PATCH] net/pcap: fix memory leak in dumper open

[ upstream commit e59196e01c1456e8ea0e9b2056651ef64dc17b78 ]

In open_single_tx_pcap there is a call to pcap_open_dead which calls
malloc to create and return a pcap_t. That object is never freed in
this case. Other places it is freed by passing it back similar to the
way the pcap_dumper_t is in this case.

The pcap_t is only used to create the pcap_dumper_t and is never used
again so freeing it here is safe and much simpler than trying to pass
it back to be freed in eth_dev_stop along with the other
pcap_t/pcap_dumper_t objects.

Fixes: 4c173302c307 ("pcap: add new driver")

Signed-off-by: Stefan Baranoff <sbaranoff at gmail.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 drivers/net/pcap/rte_eth_pcap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 1a208ffca..f6b3c10c0 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -411,11 +411,13 @@ open_single_tx_pcap(const char *pcap_filename, pcap_dumper_t **dumper)
 	/* The dumper is created using the previous pcap_t reference */
 	*dumper = pcap_dump_open(tx_pcap, pcap_filename);
 	if (*dumper == NULL) {
+		pcap_close(tx_pcap);
 		RTE_LOG(ERR, PMD, "Couldn't open %s for writing.\n",
 			pcap_filename);
 		return -1;
 	}
 
+	pcap_close(tx_pcap);
 	return 0;
 }
 
-- 
2.11.0



More information about the stable mailing list