]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix another memory leak
authorNick Mathewson <nickm@torproject.org>
Mon, 11 Feb 2013 21:12:49 +0000 (16:12 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 11 Feb 2013 21:13:52 +0000 (16:13 -0500)
This one occurs when changing configuration options. Found by
coverity.

src/or/config.c

index 90a5dfbda1c00399b141ef765470be6aeca42ad9..16eadf917b290ff713205333312fc92a602e0933 100644 (file)
@@ -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);