[tor-commits] [tor/master] Fix another memory leak

nickm at torproject.org nickm at torproject.org
Mon Feb 11 21:22:15 UTC 2013


commit afca9ab14ee16b8dcfcde40a13d49f3612138dcb
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Feb 11 16:12:49 2013 -0500

    Fix another memory leak
    
    This one occurs when changing configuration options. Found by
    coverity.
---
 src/or/config.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 90a5dfb..16eadf9 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -777,9 +777,12 @@ set_options(or_options_t *new_val, char **msg)
         line = get_assigned_option(&options_format, new_val, var_name, 1);
 
         if (line) {
-          for (; line; line = line->next) {
+          config_line_t *next;
+          for (; line; line = next) {
+            next = line->next;
             smartlist_add(elements, line->key);
             smartlist_add(elements, line->value);
+            tor_free(line);
           }
         } else {
           smartlist_add(elements, (char*)options_format.vars[i].name);





More information about the tor-commits mailing list