[sr-dev] git:master:c5cdd8dc: uid_domain: avoid double free in case of error

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 20 09:32:13 CEST 2017


Module: kamailio
Branch: master
Commit: c5cdd8dce66d94f69f773b5361ef2b477df47f06
URL: https://github.com/kamailio/kamailio/commit/c5cdd8dce66d94f69f773b5361ef2b477df47f06

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-20T09:31:49+02:00

uid_domain: avoid double free in case of error

---

Modified: src/modules/uid_domain/domain.c

---

Diff:  https://github.com/kamailio/kamailio/commit/c5cdd8dce66d94f69f773b5361ef2b477df47f06.diff
Patch: https://github.com/kamailio/kamailio/commit/c5cdd8dce66d94f69f773b5361ef2b477df47f06.patch

---

diff --git a/src/modules/uid_domain/domain.c b/src/modules/uid_domain/domain.c
index e654adf321..0c4332a106 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;




More information about the sr-dev mailing list