diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-04-26 00:13:27 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-26 00:13:27 -0400 |
commit | 9fbb5a44b801397be69f5be2c2baff05e93af0f6 (patch) | |
tree | 2fd33628a5ea7c2d4feb6d2c6a84c8e47d5090dd /src/test | |
parent | dc0fcbd8121065707274ed22cf8d25c92c3ea80e (diff) | |
download | tor-9fbb5a44b801397be69f5be2c2baff05e93af0f6.tar.gz tor-9fbb5a44b801397be69f5be2c2baff05e93af0f6.zip |
Fix memory leak in test_util_asprintf
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 6d6b6dbdf8..256d849919 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -2241,18 +2241,21 @@ test_util_asprintf(void *ptr) test_assert(cp); test_streq("simple string 100% safe", cp); test_eq(strlen(cp), r); + tor_free(cp); /* empty string */ r = tor_asprintf(&cp, "%s", ""); test_assert(cp); test_streq("", cp); test_eq(strlen(cp), r); + tor_free(cp); /* numbers (%i) */ r = tor_asprintf(&cp, "I like numbers-%2i, %i, etc.", -1, 2); test_assert(cp); test_streq("I like numbers--1, 2, etc.", cp); test_eq(strlen(cp), r); + /* don't free cp; next test uses it. */ /* numbers (%d) */ r = tor_asprintf(&cp2, "First=%d, Second=%d", 101, 202); |