examples/ip_pipeline: fix memory leak
PATCH 1/1 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 <[email protected]>
--- examples/ip_pipeline/cli.c | 3 +++ 1 file changed, 3 insertions(+)
examples/ip_pipeline/cli.c +3 -0
@@ -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 ; }
Signature · 1 line
2.9.3
Quoted 54 lines
-----Original Message-----
From: Singh, Jasvinder
Sent: Monday, April 16, 2018 5:03 PM
To: [email protected]
Cc: Dumitrescu, Cristian <[email protected]>
Subject: [PATCH] examples/ip_pipeline: fix memory leakClose the file stream before returning from the function to avoid memory leak.
Fixes 2b82ef4861c0 ("examples/ip_pipeline: add DSCP table updatecommand")
Coverty Issue: 272605Signed-off-by Jasvinder Singh <[email protected]>--- examples/ip_pipeline/cli.c | 3 +++ 1 file changed, 3 insertions(+)examples/ip_pipeline/cli.c +1
-0@@ -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) ||examples/ip_pipeline/cli.c +2
-1(strlen(tokens[2]) != 1)) { *line_number = l; +fclose (f);return -EINVAL ; }@@ -4193,6 +4195,7 @@ load_dscp_table(structrte_table_action_dscp_table *dscp_table, default: *line_number = l; +fclose (f);return -EINVAL ; } --
Quoted 1 line
2.9.3
Applied to next-pipeline tree, thanks!