aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-04-18 21:42:39 -0400
committerNick Mathewson <nickm@torproject.org>2013-04-18 21:42:39 -0400
commitab3d5c049032651a9c9164262f9a8f81de9709d4 (patch)
tree442a115f6dc3f3ba50ea36e66e43c09a6d7b5f85
parent1b5320bfe3d178c20357b9860087147a6cbb099b (diff)
parente35ca135282c6b833f51543988580bd860b49be6 (diff)
downloadtor-ab3d5c049032651a9c9164262f9a8f81de9709d4.tar.gz
tor-ab3d5c049032651a9c9164262f9a8f81de9709d4.zip
Merge remote-tracking branch 'origin/maint-0.2.4'
-rw-r--r--changes/bug87163
-rw-r--r--src/or/config.c3
-rw-r--r--src/or/control.c2
-rw-r--r--src/or/control.h2
4 files changed, 7 insertions, 3 deletions
diff --git a/changes/bug8716 b/changes/bug8716
new file mode 100644
index 0000000000..74c74f82a6
--- /dev/null
+++ b/changes/bug8716
@@ -0,0 +1,3 @@
+ o Minor bugfixes (memory leak):
+ - Fix a memory leak that would occur whenever a configuration
+ option changed. Fixes bug #8718; bugfix on 0.2.3.3-alpha.
diff --git a/src/or/config.c b/src/or/config.c
index b13fccad6a..cd9acf4f06 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -619,12 +619,13 @@ set_options(or_options_t *new_val, char **msg)
tor_free(line);
}
} else {
- smartlist_add(elements, (char*)options_format.vars[i].name);
+ smartlist_add(elements, tor_strdup(options_format.vars[i].name));
smartlist_add(elements, NULL);
}
}
}
control_event_conf_changed(elements);
+ SMARTLIST_FOREACH(elements, char *, cp, tor_free(cp));
smartlist_free(elements);
}
diff --git a/src/or/control.c b/src/or/control.c
index 390b8d1502..48782682c7 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -4393,7 +4393,7 @@ control_event_guard(const char *nickname, const char *digest,
* a smartlist_t containing (key, value, ...) pairs in sequence.
* <b>value</b> can be NULL. */
int
-control_event_conf_changed(smartlist_t *elements)
+control_event_conf_changed(const smartlist_t *elements)
{
int i;
char *result;
diff --git a/src/or/control.h b/src/or/control.h
index 0ea7941b13..61062da2c4 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -72,7 +72,7 @@ int control_event_server_status(int severity, const char *format, ...)
CHECK_PRINTF(2,3);
int control_event_guard(const char *nickname, const char *digest,
const char *status);
-int control_event_conf_changed(smartlist_t *elements);
+int control_event_conf_changed(const smartlist_t *elements);
int control_event_buildtimeout_set(const circuit_build_times_t *cbt,
buildtimeout_set_event_t type);
int control_event_signal(uintptr_t signal);