diff options
author | Gisle Vanem <gisle.vanem@gmail.com> | 2017-07-06 23:14:29 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-07-06 23:15:00 +0200 |
commit | 0cec0f461567c152dd222982d3223dbd5e3423e7 (patch) | |
tree | 1bd11cc2b6e4715ab9d16aa19754016b9b050e5a | |
parent | 2d86e8d1286e0fbe3d811e2e87fa0b5e53722db4 (diff) | |
download | curl-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.c | 3 |
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 } } |