All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Wodkowski <pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH v2 3/4] pmd ring: fix possible memory leak during devinit
Date: Wed, 25 Feb 2015 13:41:25 +0100	[thread overview]
Message-ID: <1424868086-4232-4-git-send-email-pawelx.wodkowski@intel.com> (raw)
In-Reply-To: <1424868086-4232-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Free kvlist on function exit to avoid memory leak.

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 lib/librte_pmd_ring/rte_eth_ring.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index a5dc71e..f049bb3 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -527,7 +527,7 @@ out:
 static int
 rte_pmd_ring_devinit(const char *name, const char *params)
 {
-	struct rte_kvargs *kvlist;
+	struct rte_kvargs *kvlist = NULL;
 	int ret = 0;
 	struct node_action_list *info = NULL;
 
@@ -548,7 +548,7 @@ rte_pmd_ring_devinit(const char *name, const char *params)
 			info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
 					   (sizeof(struct node_action_pair) * ret), 0);
 			if (!info)
-				goto out;
+				goto out_free;
 
 			info->total = ret;
 			info->list = (struct node_action_pair*)(info + 1);
@@ -567,8 +567,8 @@ rte_pmd_ring_devinit(const char *name, const char *params)
 	}
 
 out_free:
+	rte_kvargs_free(kvlist);
 	rte_free(info);
-out:
 	return ret;
 }
 
-- 
1.9.1

  parent reply	other threads:[~2015-02-25 12:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 14:09 [PATCH 0/5] Fix issues reported by static analysis tool Pawel Wodkowski
     [not found] ` <1424700600-1765-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-23 14:09   ` [PATCH 1/5] rte_timer: fix invalid declaration of rte_timer_cb_t Pawel Wodkowski
     [not found]     ` <1424700600-1765-2-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 10:39       ` Olivier MATZ
     [not found]         ` <54EC54C5.2060002-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-24 11:12           ` Wodkowski, PawelX
     [not found]             ` <F6F2A6264E145F47A18AB6DF8E87425D12BAD646-kPTMFJFq+rFP9JyJpTNKArfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-24 12:36               ` Olivier MATZ
2015-02-23 14:09   ` [PATCH 2/5] librte_kvargs: make rte_kvargs_free() be consistent with other "free()" functions Pawel Wodkowski
     [not found]     ` <1424700600-1765-3-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 11:30       ` Olivier MATZ
2015-02-23 14:09   ` [PATCH 3/5] pmd ring: fix possible memory leak during devinit Pawel Wodkowski
     [not found]     ` <1424700600-1765-4-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 11:05       ` Olivier MATZ
     [not found]         ` <54EC5B11.1040201-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-24 11:15           ` Pawel Wodkowski
     [not found]             ` <54EC5D6A.7040009-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 11:30               ` Olivier MATZ
2015-02-23 14:09   ` [PATCH 4/5] cmdline: make parse_set_list() use size_t instead of int for low/high parameter Pawel Wodkowski
     [not found]     ` <1424700600-1765-5-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 11:05       ` Olivier MATZ
2015-02-23 14:10   ` [PATCH 5/5] Fix usage of fgets in various places Pawel Wodkowski
     [not found]     ` <1424700600-1765-6-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-23 16:00       ` Stephen Hemminger
2015-02-24  9:20         ` Panu Matilainen
     [not found]           ` <54EC4261.6050804-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-24 19:01             ` Stephen Hemminger
2015-02-25  5:37               ` Panu Matilainen
2015-02-25 12:41   ` [PATCH v2 0/4] Fix issues reported by static analysis tool Pawel Wodkowski
     [not found]     ` <1424868086-4232-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-25 12:41       ` [PATCH v2 1/4] rte_timer: change declaration of rte_timer_cb_t Pawel Wodkowski
2015-02-25 12:41       ` [PATCH v2 2/4] librte_kvargs: make rte_kvargs_free() be consistent with other "free()" functions Pawel Wodkowski
2015-02-25 12:41       ` Pawel Wodkowski [this message]
2015-02-25 12:41       ` [PATCH v2 4/4] cmdline: make parse_set_list() use size_t instead of int for low/high parameter Pawel Wodkowski
2015-02-27 13:28       ` [PATCH v2 0/4] Fix issues reported by static analysis tool Olivier MATZ
     [not found]         ` <54F07113.5030200-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-03-04 10:27           ` Thomas Monjalon

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=1424868086-4232-4-git-send-email-pawelx.wodkowski@intel.com \
    --to=pawelx.wodkowski-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.