[or-cvs] Reorganize some quick-and-dirty code to find out what opens...

Nick Mathewson nickm at seul.org
Mon Oct 3 20:20:41 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv27221/src/or

Modified Files:
	main.c 
Log Message:
Reorganize some quick-and-dirty code to find out what openssl stuff is leaking, using dmalloc.

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.564
retrieving revision 1.565
diff -u -d -r1.564 -r1.565
--- main.c	30 Sep 2005 21:38:57 -0000	1.564
+++ main.c	3 Oct 2005 20:20:38 -0000	1.565
@@ -1907,10 +1907,23 @@
 }
 #endif
 
+#ifdef USE_DMALLOC
+#include <openssl/crypto.h>
+static void
+_tor_dmalloc_free(void *p)
+{
+  tor_free(p);
+}
+#endif
+
 /** DOCDOC */
 int
 tor_main(int argc, char *argv[])
 {
+#ifdef USE_DMALLOC
+    int r = CRYPTO_set_mem_ex_functions(_tor_malloc, _tor_realloc, _tor_dmalloc_free);
+    log_fn(LOG_NOTICE, "r = %d", r);
+#endif
 #ifdef MS_WINDOWS_SERVICE
   backup_argv = argv;
   backup_argc = argc;
@@ -1963,4 +1976,3 @@
   tor_cleanup();
   return -1;
 }
-



More information about the tor-commits mailing list