Fix a memory leak in circuit_build_times_parse_state

Thanks weasel for noticing.
This commit is contained in:
Sebastian Hahn 2010-08-15 14:22:32 +02:00
parent 8d588e7b1a
commit 70f0ba1495
2 changed files with 7 additions and 2 deletions

3
changes/bug1831 Normal file
View File

@ -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.

View File

@ -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;