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

[or-cvs] r11862: bugfix on r11298: Fix a minor memory leak whenever we parse (in tor/trunk: . src/common src/or)



Author: arma
Date: 2007-10-10 22:03:53 -0400 (Wed, 10 Oct 2007)
New Revision: 11862

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/common/util.c
   tor/trunk/src/or/circuitbuild.c
Log:
bugfix on r11298:
Fix a minor memory leak whenever we parse guards from our state
file. Bugfix on 0.2.0.7-alpha.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-11 00:13:06 UTC (rev 11861)
+++ tor/trunk/ChangeLog	2007-10-11 02:03:53 UTC (rev 11862)
@@ -91,6 +91,8 @@
   o Minor bugfixes (of some sort):
     - Stop calling tor_strlower() on uninitialized memory in some cases.
       Bugfix in 0.2.0.7-alpha.
+    - Fix a minor memory leak whenever we parse guards from our state
+      file. Bugfix on 0.2.0.7-alpha.
 
   o Code simplifications and refactoring:
     - Make a bunch of functions static.  Remove some dead code.

Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c	2007-10-11 00:13:06 UTC (rev 11861)
+++ tor/trunk/src/common/util.c	2007-10-11 02:03:53 UTC (rev 11862)
@@ -1530,8 +1530,8 @@
 /** Try to start writing to the file in <b>fname</b>, passing the flags
  * <b>open_flags</b> to the open() syscall, creating the file (if needed) with
  * access value <b>mode</b>.  If the O_APPEND flag is set, we append to the
- * original file.  Otherwise, we open a new a temporary file in the same
- * directory, and either replace the original or remove the temprorary file
+ * original file.  Otherwise, we open a new temporary file in the same
+ * directory, and either replace the original or remove the temporary file
  * when we're done.
  *
  * Return the fd for the newly opened file, and store working data in

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2007-10-11 00:13:06 UTC (rev 11861)
+++ tor/trunk/src/or/circuitbuild.c	2007-10-11 02:03:53 UTC (rev 11862)
@@ -2404,7 +2404,7 @@
   /* Finally, the remaining EntryNodes, unless we're strict */
   if (options->StrictEntryNodes) {
     SMARTLIST_FOREACH(old_entry_guards_not_on_list, entry_guard_t *, e,
-                      tor_free(e));
+                      entry_guard_free(e));
   } else {
     smartlist_add_all(entry_guards, old_entry_guards_not_on_list);
   }
@@ -2641,11 +2641,13 @@
    });
 
   if (*msg || !set) {
-    SMARTLIST_FOREACH(new_entry_guards, entry_guard_t *, e, tor_free(e));
+    SMARTLIST_FOREACH(new_entry_guards, entry_guard_t *, e,
+                      entry_guard_free(e));
     smartlist_free(new_entry_guards);
   } else { /* !*err && set */
     if (entry_guards) {
-      SMARTLIST_FOREACH(entry_guards, entry_guard_t *, e, tor_free(e));
+      SMARTLIST_FOREACH(entry_guards, entry_guard_t *, e,
+                        entry_guard_free(e));
       smartlist_free(entry_guards);
     }
     entry_guards = new_entry_guards;