memdebug: don't setbuf() if the file open failed

Bug: https://github.com/curl/curl/issues/828#issuecomment-313475151
This commit is contained in:
Gisle Vanem 2017-07-06 23:14:29 +02:00 committed by Daniel Stenberg
parent 2d86e8d128
commit 0cec0f4615
1 changed files with 2 additions and 1 deletions

View File

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