a slightly involved work-around to prevent the debug-tracing from logging
authorDaniel Stenberg <daniel@haxx.se>
Thu, 27 Jan 2005 15:59:01 +0000 (15:59 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 27 Jan 2005 15:59:01 +0000 (15:59 +0000)
a free-without-alloc as the first call

src/main.c

index 12ff3db..1558d18 100644 (file)
@@ -2934,8 +2934,13 @@ operate(struct Configurable *config, int argc, char *argv[])
   env = curlx_getenv("CURL_MEMDEBUG");
   if(env) {
     /* use the value as file name */
-    curl_memdebug(env);
+    char *s = strdup(env);
     curl_free(env);
+    curl_memdebug(s);
+    free(s);
+    /* this weird strdup() and stuff here is to make the curl_free() get
+       called before the memdebug() as otherwise the memdebug tracing will
+       with tracing a free() without an alloc! */
   }
   env = curlx_getenv("CURL_MEMLIMIT");
   if(env) {