summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Hainke <vincent@systemli.org>2021-08-30 22:37:10 +0200
committerDaniel Golle <daniel@makrotopia.org>2021-08-30 22:15:10 +0100
commit96d8bf2c7b6773636efb8b175993e5d17ff7d0bf (patch)
treeb2b881f0ba69a010cee89460936fafac6115cead
parente5b38fd1298cec50f68b01568fcecf5e626cd286 (diff)
downloadprocd-96d8bf2c7b6773636efb8b175993e5d17ff7d0bf.tar.gz
trace: fix potential use-after-free occurence
char* tmp is used in the fprintf function altough it is already freed. Fixes: e5b38fd1 ("trace: free memory allocated by blobmsg_format_json_indent()") Signed-off-by: Nick Hainke <vincent@systemli.org>
-rw-r--r--trace/trace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/trace/trace.c b/trace/trace.c
index 87a98a6..40cf3df 100644
--- a/trace/trace.c
+++ b/trace/trace.c
@@ -166,8 +166,8 @@ static void print_syscalls(int policy, const char *json)
if (!tmp)
return;
- free(tmp);
fprintf(fp, "%s\n", tmp);
+ free(tmp);
fclose(fp);
ULOG_INFO("saving syscall trace to %s\n", json);
} else {