* [dpdk-dev] [PATCH] examples/pipeline: fix resource leak
@ 2020-10-26 21:23 Cristian Dumitrescu
2020-10-29 16:31 ` David Marchand
0 siblings, 1 reply; 2+ messages in thread
From: Cristian Dumitrescu @ 2020-10-26 21:23 UTC (permalink / raw)
To: dev
Coverity issue: 363041
Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/pipeline/cli.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 8ac6b3f5f..d0150cfcf 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -779,6 +779,18 @@ cmd_pipeline_build(char **tokens,
}
}
+static void
+table_entry_free(struct rte_swx_table_entry *entry)
+{
+ if (!entry)
+ return;
+
+ free(entry->key);
+ free(entry->key_mask);
+ free(entry->action_data);
+ free(entry);
+}
+
static const char cmd_pipeline_table_update_help[] =
"pipeline <pipeline_name> table <table_name> update <file_name_add> "
"<file_name_delete> <file_name_default>";
@@ -885,6 +897,7 @@ cmd_pipeline_table_update(char **tokens,
status = rte_swx_ctl_pipeline_table_entry_add(p->ctl,
table_name,
entry);
+ table_entry_free(entry);
if (status) {
snprintf(out, out_size,
"Invalid entry in file %s at line %u",
@@ -914,6 +927,7 @@ cmd_pipeline_table_update(char **tokens,
status = rte_swx_ctl_pipeline_table_entry_delete(p->ctl,
table_name,
entry);
+ table_entry_free(entry);
if (status) {
snprintf(out, out_size,
"Invalid entry in file %s at line %u",
@@ -942,6 +956,7 @@ cmd_pipeline_table_update(char **tokens,
status = rte_swx_ctl_pipeline_table_default_entry_add(p->ctl,
table_name,
entry);
+ table_entry_free(entry);
if (status) {
snprintf(out, out_size,
"Invalid entry in file %s at line %u",
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/pipeline: fix resource leak
2020-10-26 21:23 [dpdk-dev] [PATCH] examples/pipeline: fix resource leak Cristian Dumitrescu
@ 2020-10-29 16:31 ` David Marchand
0 siblings, 0 replies; 2+ messages in thread
From: David Marchand @ 2020-10-29 16:31 UTC (permalink / raw)
To: Cristian Dumitrescu; +Cc: dev
On Mon, Oct 26, 2020 at 10:24 PM Cristian Dumitrescu
<cristian.dumitrescu@intel.com> wrote:
>
> Coverity issue: 363041
> Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-29 16:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 21:23 [dpdk-dev] [PATCH] examples/pipeline: fix resource leak Cristian Dumitrescu
2020-10-29 16:31 ` David Marchand
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).