net/softnic: fix file descriptor leak

Fix file close at pipeline code generation.

Coverity issue: 380976
Fixes: e3be2495c5 ("net/softnic: add pipeline code generation command")

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>
This commit is contained in:
Harshad Narayane 2022-09-27 00:42:09 -04:00 committed by Ferruh Yigit
parent 167756c117
commit 357d87e825

View File

@ -230,6 +230,7 @@ cmd_softnic_pipeline_codegen(struct pmd_internals *softnic __rte_unused,
code_file = fopen(tokens[3], "w");
if (!code_file) {
snprintf(out, out_size, "Cannot open file %s.\n", tokens[3]);
fclose(spec_file);
return;
}