From 15951423d8e2c5e82bd4b4c554b95cbc6f0fd9c9 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Wed, 5 Apr 2017 15:57:23 +0300 Subject: [PATCH] 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. --- server/core/test/testpoll.c | 1 - server/core/test/testqueuemanager.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/core/test/testpoll.c b/server/core/test/testpoll.c index c8f8cb012..1e966a42a 100644 --- a/server/core/test/testpoll.c +++ b/server/core/test/testpoll.c @@ -55,7 +55,6 @@ test1() ss_dfprintf(stderr, "testpoll : Initialise the polling system."); init_test_env(NULL); - poll_init(); ss_dfprintf(stderr, "\t..done\nAdd a DCB"); dcb = dcb_alloc(DCB_ROLE_CLIENT_HANDLER, &dummy); diff --git a/server/core/test/testqueuemanager.c b/server/core/test/testqueuemanager.c index ce132565e..d790bfb49 100644 --- a/server/core/test/testqueuemanager.c +++ b/server/core/test/testqueuemanager.c @@ -134,6 +134,7 @@ test1() return 10; } output_counter++; + MXS_FREE(entry.queued_object); } else { @@ -148,6 +149,7 @@ test1() return 6; } output_counter++; + MXS_FREE(entry.queued_object); } else { @@ -172,6 +174,7 @@ test1() return 8; } output_counter++; + MXS_FREE(entry.queued_object); } else { @@ -188,7 +191,7 @@ test1() } ss_dfprintf(stderr, "Successfully ended test\n"); - + mxs_queue_free(queue); return 0; } @@ -241,6 +244,7 @@ test2() 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); } + mxs_queue_free(thread_queue); return debug_check_fail ? 1 : 0; }