net/softnic: fix memory free

Message ID 20220927044230.367148-1-harshad.suresh.narayane@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/softnic: fix memory free |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed

Commit Message

Suresh Narayane, Harshad Sept. 27, 2022, 4:42 a.m. UTC
  Coverity issue: 380975
Coverity issue: 380977
Fixes: 02270033 ("net/softnic: add pipeline library build command")

Fix memory resource free for buffer allocation failure at pipeline
library build.

Signed-off-by: Harshad Narayane <harshad.suresh.narayane@intel.com>
Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Oct. 3, 2022, 11:25 p.m. UTC | #1
On 9/27/2022 5:42 AM, Harshad Narayane wrote:
> Coverity issue: 380975
> Coverity issue: 380977
> Fixes: 02270033 ("net/softnic: add pipeline library build command")
> 
> Fix memory resource free for buffer allocation failure at pipeline
> library build.
> 
> Signed-off-by: Harshad Narayane <harshad.suresh.narayane@intel.com>
> Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index e46383352b..085523fe03 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -327,7 +327,7 @@  cmd_softnic_pipeline_libbuild(struct pmd_internals *softnic __rte_unused,
 	buffer = malloc(MAX_LINE_SIZE);
 	if (!buffer) {
 		snprintf(out, out_size, MSG_OUT_OF_MEMORY);
-		return;
+		goto free;
 	}
 
 	snprintf(buffer,