diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-10-21 16:51:21 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-10-21 16:51:21 -0400 |
commit | ed0c2a5e3dec953d37736df6c86a81b4c74e108f (patch) | |
tree | f72491053c0b699c175473b5ab6e7a9c33367ed9 /src/test/test_util_process.c | |
parent | 5431c60001d5051184c2cac2fd4511346a1f1bd3 (diff) | |
download | tor-ed0c2a5e3dec953d37736df6c86a81b4c74e108f.tar.gz tor-ed0c2a5e3dec953d37736df6c86a81b4c74e108f.zip |
Fix valgrind errors in test_util_process
Diffstat (limited to 'src/test/test_util_process.c')
-rw-r--r-- | src/test/test_util_process.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/test/test_util_process.c b/src/test/test_util_process.c index 0dcf047730..04a21b86f7 100644 --- a/src/test/test_util_process.c +++ b/src/test/test_util_process.c @@ -24,21 +24,23 @@ static void test_util_process_set_waitpid_callback(void *ignored) { (void)ignored; - waitpid_callback_t *res; + waitpid_callback_t *res1 = NULL, *res2 = NULL; int previous_log = setup_capture_of_logs(LOG_WARN); pid_t pid = (pid_t)42; - res = set_waitpid_callback(pid, temp_callback, NULL); - tt_assert(res); + res1 = set_waitpid_callback(pid, temp_callback, NULL); + tt_assert(res1); - res = set_waitpid_callback(pid, temp_callback, NULL); - tt_assert(res); + res2 = set_waitpid_callback(pid, temp_callback, NULL); + tt_assert(res2); tt_str_op(mock_saved_log_at(0), OP_EQ, "Replaced a waitpid monitor on pid 42. That should be " "impossible.\n"); done: teardown_capture_of_logs(previous_log); + clear_waitpid_callback(res1); + clear_waitpid_callback(res2); } static void @@ -55,9 +57,12 @@ test_util_process_clear_waitpid_callback(void *ignored) clear_waitpid_callback(res); tt_int_op(mock_saved_log_number(), OP_EQ, 0); +#if 0 + /* No. This is use-after-free. We don't _do_ that. XXXX */ clear_waitpid_callback(res); tt_str_op(mock_saved_log_at(0), OP_EQ, "Couldn't remove waitpid monitor for pid 43.\n"); +#endif done: teardown_capture_of_logs(previous_log); |