mirror of
https://github.com/curl/curl.git
synced 2026-08-24 20:23:40 +03:00
libtest: 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. Reported-by: Štefan Kremeň
This commit is contained in:
parent
79416fb2d6
commit
cd20e81e89
2 changed files with 16 additions and 3 deletions
|
|
@ -33,6 +33,10 @@
|
|||
# include <fcntl.h> /* for setmode() */
|
||||
#endif
|
||||
|
||||
#ifdef USE_NSS
|
||||
#include <nspr.h>
|
||||
#endif
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
# define MEMDEBUG_NODEFINES
|
||||
# include "memdebug.h"
|
||||
|
|
@ -128,6 +132,7 @@ char *hexdump(unsigned char *buffer, size_t len)
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
char *URL;
|
||||
int result;
|
||||
|
||||
#ifdef O_BINARY
|
||||
# ifdef __HIGHC__
|
||||
|
|
@ -166,5 +171,13 @@ int main(int argc, char **argv)
|
|||
|
||||
fprintf(stderr, "URL: %s\n", URL);
|
||||
|
||||
return test(URL);
|
||||
result = test(URL);
|
||||
|
||||
#ifdef USE_NSS
|
||||
if(PR_Initialized())
|
||||
/* prevent valgrind from reporting possibly lost memory (fd cache, ...) */
|
||||
PR_Cleanup();
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue