* [dpdk-dev] [PATCH] examples/ip_pipeline: fix memory leak
@ 2018-04-16 16:03 Jasvinder Singh
2018-05-08 14:29 ` Dumitrescu, Cristian
0 siblings, 1 reply; 2+ messages in thread
From: Jasvinder Singh @ 2018-04-16 16:03 UTC (permalink / raw)
To: dev; +Cc: cristian.dumitrescu
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix memory leak
2018-04-16 16:03 [dpdk-dev] [PATCH] examples/ip_pipeline: fix memory leak Jasvinder Singh
@ 2018-05-08 14:29 ` Dumitrescu, Cristian
0 siblings, 0 replies; 2+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-08 14:29 UTC (permalink / raw)
To: Singh, Jasvinder, dev
> -----Original Message-----
> From: Singh, Jasvinder
> Sent: Monday, April 16, 2018 5:03 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix memory leak
>
> 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
Acked-by: Cristian.Dumitrescu <cristian.dumitrescu@intel.com>
Applied to next-pipeline tree, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-08 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 16:03 [dpdk-dev] [PATCH] examples/ip_pipeline: fix memory leak Jasvinder Singh
2018-05-08 14:29 ` Dumitrescu, Cristian
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).