DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/7] pipeline: fix memory free issues
Date: Tue,  6 Oct 2020 21:37:52 +0100	[thread overview]
Message-ID: <20201006203755.90779-4-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20201006203755.90779-1-cristian.dumitrescu@intel.com>

Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file")
Coverity issues: 362796, 362804, 362819, 362836, 362858, 362865,
362869

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_pipeline_spec.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/librte_pipeline/rte_swx_pipeline_spec.c b/lib/librte_pipeline/rte_swx_pipeline_spec.c
index 06e1ab438..a4bc8226a 100644
--- a/lib/librte_pipeline/rte_swx_pipeline_spec.c
+++ b/lib/librte_pipeline/rte_swx_pipeline_spec.c
@@ -35,9 +35,17 @@ struct extobj_spec {
 static void
 extobj_spec_free(struct extobj_spec *s)
 {
+	if (!s)
+		return;
+
 	free(s->name);
+	s->name = NULL;
+
 	free(s->extern_type_name);
+	s->extern_type_name = NULL;
+
 	free(s->pragma);
+	s->pragma = NULL;
 }
 
 static int
@@ -246,8 +254,14 @@ struct header_spec {
 static void
 header_spec_free(struct header_spec *s)
 {
+	if (!s)
+		return;
+
 	free(s->name);
+	s->name = NULL;
+
 	free(s->struct_type_name);
+	s->struct_type_name = NULL;
 }
 
 static int
@@ -297,7 +311,11 @@ struct metadata_spec {
 static void
 metadata_spec_free(struct metadata_spec *s)
 {
+	if (!s)
+		return;
+
 	free(s->struct_type_name);
+	s->struct_type_name = NULL;
 }
 
 static int
-- 
2.17.1


  parent reply	other threads:[~2020-10-06 20:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 2/7] examples/pipeline: fix files for table update Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 3/7] pipeline: fix argument check Cristian Dumitrescu
2020-10-06 20:37 ` Cristian Dumitrescu [this message]
2020-10-06 20:37 ` [dpdk-dev] [PATCH 5/7] pipeline: fix resource leak issue Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 6/7] pipeline: fix unused variable issue Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 7/7] pipeline: fix instruction config free Cristian Dumitrescu
2020-10-08 13:07 ` [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue David Marchand

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=20201006203755.90779-4-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.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 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).