From c5cdd8dce66d94f69f773b5361ef2b477df47f06 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 20 Jul 2017 09:30:16 +0200 Subject: [PATCH] uid_domain: avoid double free in case of error --- src/modules/uid_domain/domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/uid_domain/domain.c b/src/modules/uid_domain/domain.c index e654adf321c..0c4332a1064 100644 --- a/src/modules/uid_domain/domain.c +++ b/src/modules/uid_domain/domain.c @@ -244,7 +244,7 @@ int load_domains(domain_t** dest) list = 0; - if (db_exec(&res, load_domains_cmd) < 0) { + if ((db_exec(&res, load_domains_cmd) < 0) || (res==NULL)) { ERR("Error while querying database\n"); return -1; } @@ -292,6 +292,7 @@ int load_domains(domain_t** dest) } db_res_free(res); + res = NULL; if (load_domain_attrs) { d = list;