From 401cb929543e3370726574c01fd90d965c5b3c60 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 12 Mar 2019 08:37:18 +0100 Subject: memdebug: log pointer before freeing its data Coverity warned for two potentional "Use after free" cases. Both are false positives because the memory wasn't used, it was only the actual pointer value that was logged. The fix still changes the order of execution to avoid the warnings. Coverity CID 1443033 and 1443034 Closes #3671 --- lib/memdebug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/memdebug.c') diff --git a/lib/memdebug.c b/lib/memdebug.c index 5fcddc4e1..e3ac8edf7 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -463,11 +463,11 @@ int curl_dbg_fclose(FILE *file, int line, const char *source) DEBUGASSERT(file != NULL); - res = fclose(file); - if(source) curl_dbg_log("FILE %s:%d fclose(%p)\n", - source, line, (void *)file); + source, line, (void *)file); + + res = fclose(file); return res; } -- cgit v1.2.3