tool: call PL_ArenaFinish() on exit if NSPR is used
authorKamil Dudka <kdudka@redhat.com>
Thu, 3 Jul 2014 18:19:35 +0000 (20:19 +0200)
committerKamil Dudka <kdudka@redhat.com>
Thu, 3 Jul 2014 18:27:20 +0000 (20:27 +0200)
This prevents valgrind from reporting still reachable memory allocated
by NSPR arenas (mainly the freelist).

Reported-by: Hubert Kario
src/tool_main.c

index dc980e0..b815726 100644 (file)
@@ -210,9 +210,12 @@ static void main_free(struct GlobalConfig *config)
   convert_cleanup();
   metalink_cleanup();
 #ifdef USE_NSS
-  if(PR_Initialized())
+  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);