From: beilei.xing@intel.com
To: jingjing.wu@intel.com, yuying.zhang@intel.com
Cc: dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>, stable@dpdk.org
Subject: [PATCH v2] net/cpfl: fix memory leak
Date: Wed, 18 Oct 2023 14:27:23 +0000 [thread overview]
Message-ID: <20231018142723.835474-1-beilei.xing@intel.com> (raw)
In-Reply-To: <20231017110655.582873-1-beilei.xing@intel.com>
From: Beilei Xing <beilei.xing@intel.com>
Fix resource leak reported in coverity scan.
Coverity issue: 403265
Fixes: 2d823ecd671c ("net/cpfl: support device initialization")
Fixes: 989465ac51ea ("net/cpfl: support probe again")
Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v2 change:
- add label finish for successful case.
drivers/net/cpfl/cpfl_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index 890a027a1d..a94a0604f5 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -1626,7 +1626,8 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
if (rte_kvargs_count(kvlist, CPFL_VPORT) > 1) {
PMD_INIT_LOG(ERR, "devarg vport is duplicated.");
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail;
}
ret = rte_kvargs_process(kvlist, CPFL_REPRESENTOR, &parse_repr, cpfl_args);
@@ -1635,7 +1636,7 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
goto fail;
if (!first)
- return 0;
+ goto finish;
ret = rte_kvargs_process(kvlist, CPFL_VPORT, &parse_vport,
cpfl_args);
@@ -1663,6 +1664,7 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
cpfl_args->flow_parser[0] = '\0';
}
#endif
+finish:
fail:
rte_kvargs_free(kvlist);
return ret;
--
2.34.1
next prev parent reply other threads:[~2023-10-18 6:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 11:06 [PATCH] " beilei.xing
2023-10-18 2:05 ` Zhang, Qi Z
2023-10-18 14:27 ` beilei.xing [this message]
2023-10-19 1:16 ` [PATCH v2] " Zhang, Qi Z
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=20231018142723.835474-1-beilei.xing@intel.com \
--to=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=stable@dpdk.org \
--cc=yuying.zhang@intel.com \
/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).