From 0cec0f461567c152dd222982d3223dbd5e3423e7 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Thu, 6 Jul 2017 23:14:29 +0200 Subject: memdebug: don't setbuf() if the file open failed Bug: https://github.com/curl/curl/issues/828#issuecomment-313475151 --- lib/memdebug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/memdebug.c') 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 } } -- cgit v1.2.3