Fix memory errors in test_poll and test_queuemanager

test_poll was calling poll_init() two times since it's already included in
init_test_env().

test_queuemanager was missing a bunch of frees. This doesn't fix it completely,
but removes most of the leaks and valgrind errors.
This commit is contained in:
Esa Korhonen
2017-04-05 15:57:23 +03:00
parent b1f66d21c8
commit 15951423d8
2 changed files with 5 additions and 2 deletions

View File

@ -55,7 +55,6 @@ test1()
ss_dfprintf(stderr, ss_dfprintf(stderr,
"testpoll : Initialise the polling system."); "testpoll : Initialise the polling system.");
init_test_env(NULL); init_test_env(NULL);
poll_init();
ss_dfprintf(stderr, "\t..done\nAdd a DCB"); ss_dfprintf(stderr, "\t..done\nAdd a DCB");
dcb = dcb_alloc(DCB_ROLE_CLIENT_HANDLER, &dummy); dcb = dcb_alloc(DCB_ROLE_CLIENT_HANDLER, &dummy);

View File

@ -134,6 +134,7 @@ test1()
return 10; return 10;
} }
output_counter++; output_counter++;
MXS_FREE(entry.queued_object);
} }
else else
{ {
@ -148,6 +149,7 @@ test1()
return 6; return 6;
} }
output_counter++; output_counter++;
MXS_FREE(entry.queued_object);
} }
else else
{ {
@ -172,6 +174,7 @@ test1()
return 8; return 8;
} }
output_counter++; output_counter++;
MXS_FREE(entry.queued_object);
} }
else else
{ {
@ -188,7 +191,7 @@ test1()
} }
ss_dfprintf(stderr, "Successfully ended test\n"); ss_dfprintf(stderr, "Successfully ended test\n");
mxs_queue_free(queue);
return 0; return 0;
} }
@ -241,6 +244,7 @@ test2()
ss_info_dassert((0 == err), "Must join threads successfully"); ss_info_dassert((0 == err), "Must join threads successfully");
ss_dfprintf(stderr, "\nThread %d ended with debug check fail at %d.\n", i, debug_check_fail); ss_dfprintf(stderr, "\nThread %d ended with debug check fail at %d.\n", i, debug_check_fail);
} }
mxs_queue_free(thread_queue);
return debug_check_fail ? 1 : 0; return debug_check_fail ? 1 : 0;
} }