uid_domain: avoid double free in case of error
authorDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 20 Jul 2017 07:30:16 +0000 (09:30 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 20 Jul 2017 07:31:49 +0000 (09:31 +0200)
src/modules/uid_domain/domain.c

index e654adf..0c4332a 100644 (file)
@@ -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;