]> granicus.if.org Git - curl/commitdiff
memory debugging is now only enabled if the CURL_MEMDEBUG environment
authorDaniel Stenberg <daniel@haxx.se>
Thu, 28 Feb 2002 12:35:09 +0000 (12:35 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 28 Feb 2002 12:35:09 +0000 (12:35 +0000)
variable is set when curl is invoked

src/main.c

index 3cfd4a9b5e0176b438ad749d3db3a751cedf92f2..caf02e7ccc25e3b1e1f8e801e30479fef59bf078 100644 (file)
@@ -1890,13 +1890,18 @@ operate(struct Configurable *config, int argc, char *argv[])
   int res = 0;
   int i;
 
-  errorbuffer[0]=0; /* prevent junk from being output */
-
 #ifdef MALLOCDEBUG
   /* this sends all memory debug messages to a logfile named memdump */
-  curl_memdebug("memdump");
+  char *env;
+  env = curl_getenv("CURL_MEMDEBUG");
+  if(env) {
+    free(env);
+    curl_memdebug("memdump");
+  }
 #endif
 
+  errorbuffer[0]=0; /* prevent junk from being output */
+
   main_init(); /* inits */
 
   config->showerror=TRUE;