DPDK patches and discussions
 help / color / mirror / Atom feed
From: Liang Ma <liang.j.ma@intel.com>
To: dev@dpdk.org
Cc: harry.van.haaren@intel.com, bruce.richardson@intel.com,
	peter.mccarthy@intel.com, jerin.jacob@caviumnetworks.com
Subject: [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue
Date: Wed, 24 Jan 2018 15:05:50 +0000	[thread overview]
Message-ID: <1516806351-151804-1-git-send-email-liang.j.ma@intel.com> (raw)

Fixes: d548ef513cd7 ("event/opdl: add unit tests")
Coverity issue: 257004

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
---
 drivers/event/opdl/opdl_test.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 44a5cc5..4894c08 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -1002,11 +1002,13 @@ opdl_selftest(void)
 		/* turn on stats by default */
 		if (rte_vdev_init(eventdev_name, "do_validation=1") < 0) {
 			PMD_DRV_LOG(ERR, "Error creating eventdev\n");
+			free(t);
 			return -1;
 		}
 		evdev = rte_event_dev_get_dev_id(eventdev_name);
 		if (evdev < 0) {
 			PMD_DRV_LOG(ERR, "Error finding newly created eventdev\n");
+			free(t);
 			return -1;
 		}
 	}
@@ -1022,6 +1024,7 @@ opdl_selftest(void)
 				rte_socket_id());
 		if (!eventdev_func_mempool) {
 			PMD_DRV_LOG(ERR, "ERROR creating mempool\n");
+			free(t);
 			return -1;
 		}
 	}
@@ -1044,9 +1047,9 @@ opdl_selftest(void)
 	ret = single_link_w_stats(t);
 
 	/*
-	 * Free test instance, leaving mempool initialized, and a pointer to it
-	 * in static eventdev_func_mempool, as it is re-used on re-runs
+	 * Free test instance, free  mempool
 	 */
+	rte_mempool_free(t->mbuf_pool);
 	free(t);
 
 	if (ret != 0)
-- 
2.7.5

             reply	other threads:[~2018-01-24 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 15:05 Liang Ma [this message]
2018-01-24 15:05 ` [dpdk-dev] [PATCH 2/2] event/opdl: fix dereference before null check Liang Ma
2018-01-31  9:43 ` [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516806351-151804-1-git-send-email-liang.j.ma@intel.com \
    --to=liang.j.ma@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=peter.mccarthy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).