Skip to content

Commit

Permalink
tool: call PR_Cleanup() on exit if NSPR is used
Browse files Browse the repository at this point in the history
This prevents valgrind from reporting possibly lost memory that NSPR
uses for file descriptor cache and other globally allocated internal
data structures.
  • Loading branch information
kdudka committed Jul 2, 2014
1 parent 7581dee commit 24c3cdc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES
Expand Up @@ -36,6 +36,7 @@ This release includes the following bugfixes:
o Curl_rand: Use a fake entropy for debug builds when CURL_ENTROPY set
o nss: do not abort on connection failure (failing tests 305 and 404)
o nss: make the fallback to SSLv3 work again
o tool: prevent valgrind from reporting possibly lost memory (nss only)
o

This release includes the following known bugs:
Expand Down
9 changes: 9 additions & 0 deletions src/tool_main.c
Expand Up @@ -27,6 +27,10 @@
#include <signal.h>
#endif

#ifdef USE_NSS
#include <nspr.h>
#endif

#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 24c3cdc

Please sign in to comment.