projects
/
project
/
procd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
773e8da
)
trace: don't leak file descriptor in error path
author
Daniel Golle
<daniel@makrotopia.org>
Sun, 5 Sep 2021 13:22:33 +0000
(14:22 +0100)
committer
Daniel Golle
<daniel@makrotopia.org>
Wed, 15 Sep 2021 20:43:16 +0000
(21:43 +0100)
Coverity CID:
1491022
Resource leak
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
trace/trace.c
patch
|
blob
|
history
diff --git
a/trace/trace.c
b/trace/trace.c
index 40cf3df5b9adc031bd04a34e2beec401728fee00..d895798e762e13af3cf90beee2590a706b302b6b 100644
(file)
--- a/
trace/trace.c
+++ b/
trace/trace.c
@@
-163,8
+163,10
@@
static void print_syscalls(int policy, const char *json)
FILE *fp = fopen(json, "w");
if (fp) {
tmp = blobmsg_format_json_indent(b.head, true, 0);
- if (!tmp)
+ if (!tmp) {
+ fclose(fp);
return;
+ }
fprintf(fp, "%s\n", tmp);
free(tmp);