From 24c3cdce88f39731506c287cb276e8bf4a1ce393 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 2 Jul 2014 16:34:48 +0200 Subject: tool: call PR_Cleanup() on exit if NSPR is used This prevents valgrind from reporting possibly lost memory that NSPR uses for file descriptor cache and other globally allocated internal data structures. --- src/tool_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/tool_main.c') diff --git a/src/tool_main.c b/src/tool_main.c index ef96dc3a4..dc980e00c 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -27,6 +27,10 @@ #include #endif +#ifdef USE_NSS +#include +#endif + #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ #include "curlx.h" @@ -205,6 +209,11 @@ static void main_free(struct GlobalConfig *config) curl_global_cleanup(); convert_cleanup(); metalink_cleanup(); +#ifdef USE_NSS + if(PR_Initialized()) + /* prevent valgrind from reporting possibly lost memory (fd cache, ...) */ + PR_Cleanup(); +#endif free_config_fields(config); /* Free the config structures */ -- cgit v1.2.3