dovecot-2.0: master: Memory leak fix if services couldn't be ini...

dovecot at dovecot.org dovecot at dovecot.org
Fri Mar 4 20:37:05 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/65e943eafe8b
changeset: 12649:65e943eafe8b
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Mar 04 20:01:03 2011 +0200
description:
master: Memory leak fix if services couldn't be initialized.
(On config reload.)

diffstat:

 src/master/service.c |  21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r e758f10f40c1 -r 65e943eafe8b src/master/service.c
--- a/src/master/service.c	Fri Mar 04 19:51:44 2011 +0200
+++ b/src/master/service.c	Fri Mar 04 20:01:03 2011 +0200
@@ -426,18 +426,16 @@
 	return FALSE;
 }
 
-int services_create(const struct master_settings *set,
-		    struct service_list **services_r, const char **error_r)
+static int
+services_create_real(const struct master_settings *set, pool_t pool,
+		     struct service_list **services_r, const char **error_r)
 {
 	struct service_list *service_list;
 	struct service *service;
 	struct service_settings *const *service_settings;
-	pool_t pool;
 	const char *error;
 	unsigned int i, count;
 
-	pool = pool_alloconly_create("services pool", 4096);
-
 	service_list = p_new(pool, struct service_list, 1);
 	service_list->refcount = 1;
 	service_list->pool = pool;
@@ -504,6 +502,19 @@
 	return 0;
 }
 
+int services_create(const struct master_settings *set,
+		    struct service_list **services_r, const char **error_r)
+{
+	pool_t pool;
+
+	pool = pool_alloconly_create("services pool", 4096);
+	if (services_create_real(set, pool, services_r, error_r) < 0) {
+		pool_unref(&pool);
+		return -1;
+	}
+	return 0;
+}
+
 void service_signal(struct service *service, int signo)
 {
 	struct service_process *process = service->processes;


More information about the dovecot-cvs mailing list