summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya V. Matveychikov <matvejchikov@gmail.com>2017-11-10 16:55:16 +0300
committerThomas Monjalon <thomas@monjalon.net>2017-11-12 04:15:54 +0100
commitef1d0e390e056916438ad74c4fa0333c3f09aaa6 (patch)
tree7994cd322d83bdce257c48a6c5e65cff9c10ec2d
parent4c20622a95087b42ddb403406d3877a9dc3d731b (diff)
downloaddpdk-ef1d0e390e056916438ad74c4fa0333c3f09aaa6.zip
dpdk-ef1d0e390e056916438ad74c4fa0333c3f09aaa6.tar.gz
dpdk-ef1d0e390e056916438ad74c4fa0333c3f09aaa6.tar.xz
pdump: fix possible mbuf leak on failure
If pdump_pktmbuf_copy_data() fails it's possible to have segment leak as rte_pktmbuf_free() only handles m_dup chain but not the seg just allocated and yet not chained. Fixes: 278f945402c5 ("pdump: add new library for packet capture") Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
-rw-r--r--lib/librte_pdump/rte_pdump.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index e6182d3..fec49b5 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -153,6 +153,8 @@ pdump_pktmbuf_copy(struct rte_mbuf *m, struct rte_mempool *mp)
do {
nseg++;
if (pdump_pktmbuf_copy_data(seg, m) < 0) {
+ if (seg != m_dup)
+ rte_pktmbuf_free_seg(seg);
rte_pktmbuf_free(m_dup);
return NULL;
}