From: Gisle Vanem Date: Thu, 6 Jul 2017 21:14:29 +0000 (+0200) Subject: memdebug: don't setbuf() if the file open failed X-Git-Tag: curl-7_55_0~90 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0cec0f461567c152dd222982d3223dbd5e3423e7;p=curl memdebug: don't setbuf() if the file open failed Bug: https://github.com/curl/curl/issues/828#issuecomment-313475151 --- 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 } }