DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com
Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: fix memory leak
Date: Mon, 16 Apr 2018 17:03:11 +0100	[thread overview]
Message-ID: <20180416160311.112470-1-jasvinder.singh@intel.com> (raw)

Close the file stream before returning from the function to avoid
memory leak.

Fixes: 2b82ef4861c0 ("examples/ip_pipeline: add DSCP table update command")
Coverty Issue: 272605

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 examples/ip_pipeline/cli.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 199a31f..20fbefb 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -4158,6 +4158,7 @@ load_dscp_table(struct rte_table_action_dscp_table *dscp_table,
 
 		if (parse_tokenize_string(line, tokens, &n_tokens)) {
 			*line_number = l;
+			fclose(f);
 			return -EINVAL;
 		}
 
@@ -4172,6 +4173,7 @@ load_dscp_table(struct rte_table_action_dscp_table *dscp_table,
 			(tc_queue_id >= RTE_TABLE_ACTION_TC_QUEUE_MAX) ||
 			(strlen(tokens[2]) != 1)) {
 			*line_number = l;
+			fclose(f);
 			return -EINVAL;
 		}
 
@@ -4193,6 +4195,7 @@ load_dscp_table(struct rte_table_action_dscp_table *dscp_table,
 
 		default:
 			*line_number = l;
+			fclose(f);
 			return -EINVAL;
 		}
 
-- 
2.9.3

             reply	other threads:[~2018-04-16 16:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 16:03 Jasvinder Singh [this message]
2018-05-08 14:29 ` Dumitrescu, Cristian

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=20180416160311.112470-1-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=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).