From: Nick Hainke Date: Mon, 30 Aug 2021 20:37:10 +0000 (+0200) Subject: trace: fix potential use-after-free occurence X-Git-Url: http://git.openwrt.org/ubox.git?a=commitdiff_plain;h=96d8bf2c7b6773636efb8b175993e5d17ff7d0bf;p=project%2Fprocd.git 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 --- 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 {