[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r11413: Fix a couple of memory leaks in eventdns.c; found by niels. (in tor/trunk: . src/or)



Author: nickm
Date: 2007-09-10 09:48:01 -0400 (Mon, 10 Sep 2007)
New Revision: 11413

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/eventdns.c
Log:
 r15001@catbus:  nickm | 2007-09-10 09:44:49 -0400
 Fix a couple of memory leaks in eventdns.c; found by niels.  Not backport candidates, since they only affect DNSPort users.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15001] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-09-10 13:47:56 UTC (rev 11412)
+++ tor/trunk/ChangeLog	2007-09-10 13:48:01 UTC (rev 11413)
@@ -27,6 +27,8 @@
       "experimental", since it seems to have worked fine for ages.
     - Fix a user-triggerable segfault in expand_filename().  (There isn't
       a way to trigger this remotely.)
+    - Fix a memory leak when freeing incomplete requests from DNSPort.
+      (Found by Niels Provos with valgrind.)
 
   o Code simplifications and refactoring:
     - Revamp file-writing logic so we don't need to have the entire contents

Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c	2007-09-10 13:47:56 UTC (rev 11412)
+++ tor/trunk/src/or/eventdns.c	2007-09-10 13:48:01 UTC (rev 11413)
@@ -1745,7 +1745,7 @@
 			free(victim->name);
 			if (victim->data)
 				free(victim->data);
-			/* XXXX free(victim?) -NM */
+			free(victim);
 			victim = next;
 		}
 		*list = NULL;
@@ -1761,6 +1761,7 @@
 	if (req->base.questions) {
 		for (i = 0; i < req->base.nquestions; ++i)
 			free(req->base.questions[i]);
+		free(req->base.questions);
 	}
 
 	if (req->port) {