summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGisle Vanem <gisle.vanem@gmail.com>2017-07-06 23:14:29 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-07-06 23:15:00 +0200
commit0cec0f461567c152dd222982d3223dbd5e3423e7 (patch)
tree1bd11cc2b6e4715ab9d16aa19754016b9b050e5a
parent2d86e8d1286e0fbe3d811e2e87fa0b5e53722db4 (diff)
downloadcurl-0cec0f461567c152dd222982d3223dbd5e3423e7.tar.gz
memdebug: don't setbuf() if the file open failed
Bug: https://github.com/curl/curl/issues/828#issuecomment-313475151
-rw-r--r--lib/memdebug.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 2b8808ab0..16434f819 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -115,7 +115,8 @@ void curl_memdebug(const char *logname)
logfile = stderr;
#ifdef MEMDEBUG_LOG_SYNC
/* Flush the log file after every line so the log isn't lost in a crash */
- setbuf(logfile, (char *)NULL);
+ if(logfile)
+ setbuf(logfile, (char *)NULL);
#endif
}
}