]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix leak that wasn't really a leak Closes #1122
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 7 Jul 2015 21:44:14 +0000 (17:44 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 7 Jul 2015 21:44:28 +0000 (17:44 -0400)
The server would immediately exit anyway, but for code cleanliness we should probably fix it. As reported by jpereira.

src/modules/rlm_ldap/clients.c

index 5b9d88273c205ef0281909fc83bb9b992157e07f..8654475cdcebf0578c4a7d4ebf48e2944ec43e2e 100644 (file)
@@ -127,10 +127,16 @@ int rlm_ldap_client_load(rlm_ldap_t const *inst, CONF_SECTION *tmpl, CONF_SECTIO
         *      Create an array of LDAP attributes to feed to rlm_ldap_search.
         */
        attrs = talloc_array(inst, char const *, count);
-       if (rlm_ldap_client_get_attrs(attrs, &idx, map) < 0) return -1;
+       if (rlm_ldap_client_get_attrs(attrs, &idx, map) < 0) {
+               talloc_free(attrs);
+               return -1;
+       }
 
        conn = mod_conn_get(inst, NULL);
-       if (!conn) return -1;
+       if (!conn) {
+               talloc_free(attrs);
+               return -1;
+       }
 
        /*
         *      Perform all searches as the admin user.