[PATCH] examples/pipeline: fix file close

DORMANTno replies REVIEWED: 1 (0M)

From: Harshad Narayane <hidden>
Date: 2022-09-27 06:58:57
Subsystem: the rest · Maintainer: Linus Torvalds

1 review trailer.

Coverity issue: 380860
Fixes: 9043f66a ("examples/pipeline: add command for code generation")

Fix file close at pipeline code generation.

Signed-off-by: Harshad Narayane <redacted>
Signed-off-by: Kamalakannan R <redacted>
Acked-by: Cristian Dumitrescu <redacted>
---
 examples/pipeline/cli.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 8013541c4b..1158e51e89 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -545,6 +545,7 @@ cmd_pipeline_codegen(char **tokens,
 	code_file = fopen(tokens[3], "w");
 	if (!code_file) {
 		snprintf(out, out_size, "Cannot open file %s.\n", tokens[3]);
+		fclose(spec_file);
 		return;
 	}
 
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help