Revert "Update to 7.40.1"
[platform/upstream/curl.git] / src / tool_main.c
index ef96dc3..8c8acc6 100644 (file)
 #include <signal.h>
 #endif
 
+#ifdef USE_NSS
+#include <nspr.h>
+#include <plarenas.h>
+#endif
+
 #define ENABLE_CURLX_PRINTF
 /* use our own printf() functions */
 #include "curlx.h"
@@ -205,6 +210,14 @@ static void main_free(struct GlobalConfig *config)
   curl_global_cleanup();
   convert_cleanup();
   metalink_cleanup();
+#ifdef USE_NSS
+  if(PR_Initialized()) {
+    /* prevent valgrind from reporting still reachable mem from NSRP arenas */
+    PL_ArenaFinish();
+    /* prevent valgrind from reporting possibly lost memory (fd cache, ...) */
+    PR_Cleanup();
+  }
+#endif
   free_config_fields(config);
 
   /* Free the config structures */