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 } }