summaryrefslogtreecommitdiff
path: root/Utilities/cmcurl/lib/memdebug.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-08-03 14:26:53 -0400
committerBrad King <brad.king@kitware.com>2016-08-03 14:26:53 -0400
commitf53f4a8a2d215dac634effea575a27e000dfcb29 (patch)
tree5782e71da9e12ab6081e47f8eaf8eeb908e1428a /Utilities/cmcurl/lib/memdebug.c
parente1c11352f231ae310339cd539ed59cb302bd4dbe (diff)
parent202adcfe056681109fe61569ecdb3bd69f0b4f97 (diff)
downloadcmake-f53f4a8a2d215dac634effea575a27e000dfcb29.tar.gz
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2016-08-03 (f2cb3a01)
Diffstat (limited to 'Utilities/cmcurl/lib/memdebug.c')
-rw-r--r--Utilities/cmcurl/lib/memdebug.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/Utilities/cmcurl/lib/memdebug.c b/Utilities/cmcurl/lib/memdebug.c
index dd8889b2db..ccbf461be6 100644
--- a/Utilities/cmcurl/lib/memdebug.c
+++ b/Utilities/cmcurl/lib/memdebug.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@@ -26,10 +26,12 @@
#include <curl/curl.h>
-#include "curl_printf.h"
#include "urldata.h"
#define MEMDEBUG_NODEFINES /* don't redefine the standard functions */
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
@@ -117,7 +119,7 @@ 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 */
- setvbuf(logfile, (char *)NULL, _IOLBF, 0);
+ setbuf(logfile, (char *)NULL);
#endif
}
}
@@ -146,6 +148,7 @@ static bool countcheck(const char *func, int line, const char *source)
/* log to stderr also */
fprintf(stderr, "LIMIT %s:%d %s reached memlimit\n",
source, line, func);
+ fflush(logfile); /* because it might crash now */
}
SET_ERRNO(ENOMEM);
return TRUE; /* RETURN ERROR! */
@@ -153,10 +156,6 @@ static bool countcheck(const char *func, int line, const char *source)
else
memsize--; /* countdown */
- /* log the countdown */
- if(source)
- curl_memlog("LIMIT %s:%d %ld ALLOCS left\n",
- source, line, memsize);
}