dovecot-2.2: lib-master: stop tests from leaking memory

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 16 10:30:22 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/80a47f533fbf
changeset: 19361:80a47f533fbf
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Nov 16 12:26:50 2015 +0200
description:
lib-master: stop tests from leaking memory
This permits Valgrind to run without complaint.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib-master/test-master-service-settings-cache.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r f049fe9e7799 -r 80a47f533fbf src/lib-master/test-master-service-settings-cache.c
--- a/src/lib-master/test-master-service-settings-cache.c	Mon Nov 16 12:26:32 2015 +0200
+++ b/src/lib-master/test-master-service-settings-cache.c	Mon Nov 16 12:26:50 2015 +0200
@@ -98,15 +98,20 @@
 		test_master_service_settings_cache,
 		NULL
 	};
+	pool_t pool;
+	int ret;
 
 	memset(&input, 0, sizeof(input));
 	input.module = "module";
 	input.service = "service_name";
 
 	set.config_cache_size = 1024*4;
+	pool = pool_alloconly_create("set pool", 1024);
 	test_master_service.set_parser =
-		settings_parser_init(pool_alloconly_create("set pool", 1024),
-			&test_setting_parser_info, 0);
+		settings_parser_init(pool, &test_setting_parser_info, 0);
 	master_service = &test_master_service;
-	return test_run(test_functions);
+	ret = test_run(test_functions);
+	settings_parser_deinit(&test_master_service.set_parser);
+	pool_unref(&pool);
+	return ret;
 }


More information about the dovecot-cvs mailing list