summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-08-15 14:22:32 +0200
committerSebastian Hahn <sebastian@torproject.org>2010-08-16 00:33:29 +0200
commit70f0ba1495dce3b7c912354e2690fa9588b4e5b5 (patch)
tree5e254010f9bae2aa3414905dc52e47152f84dc6d
parent8d588e7b1a4fccffaa8318ed14d00a2ef615c53a (diff)
downloadtor-70f0ba1495dce3b7c912354e2690fa9588b4e5b5.tar.gz
tor-70f0ba1495dce3b7c912354e2690fa9588b4e5b5.zip
Fix a memory leak in circuit_build_times_parse_state
Thanks weasel for noticing.
-rw-r--r--changes/bug18313
-rw-r--r--src/or/circuitbuild.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/changes/bug1831 b/changes/bug1831
new file mode 100644
index 0000000000..40b3fcf52c
--- /dev/null
+++ b/changes/bug1831
@@ -0,0 +1,3 @@
+ o Minor bugfixes
+ - Fix a memory leak in the error case of circuit_build_times_parse_state().
+ Bugfix on 0.2.2.14-alpha; fixes bug 1831 partially.
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 5bb9d70d5d..9749a56fec 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -692,7 +692,8 @@ circuit_build_times_parse_state(circuit_build_times_t *cbt,
"Corrupt state file? Build times count mismatch. "
"Read %d times, but file says %d", loaded_cnt,
state->TotalBuildTimes);
- *msg = tor_strdup("Build times count mismatch.");
+ if (!*msg)
+ *msg = tor_strdup("Build times count mismatch.");
circuit_build_times_reset(cbt);
tor_free(loaded_times);
return -1;
@@ -716,7 +717,8 @@ circuit_build_times_parse_state(circuit_build_times_t *cbt,
"Corrupt state file? Shuffled build times mismatch. "
"Read %d times, but file says %d", tot_values,
state->TotalBuildTimes);
- *msg = tor_strdup("Build times count mismatch.");
+ if (!*msg)
+ *msg = tor_strdup("Build times count mismatch.");
circuit_build_times_reset(cbt);
tor_free(loaded_times);
return -1;