From 3b6975d06da89c6eedcdd1f37e81b6cb8ec4befd Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 23 Nov 2012 19:01:49 -0700 Subject: [PATCH] ext_edirectory_userip_acl: Polish: Remove dead code * filter variable being NULL results in error condition returned before the filter is used. No need to test and use a hard-coded backup filter. * ber variable is freed in the master loop and is not skipped. The loop only exists when ent is NULL. Neither needs to be freed. Detected by Coverity Scan. Issues 740339, 740340, 740341 --- .../eDirectory_userip/ext_edirectory_userip_acl.cc | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc b/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc index db774ef9e9..8751c0806d 100644 --- a/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc +++ b/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc @@ -1178,10 +1178,7 @@ SearchLDAP(edui_ldap_t *l, int scope, char *filter, char **attrs) if (l->lm != NULL) ldap_msgfree(l->lm); /* Make sure l->lm is empty */ - if (filter == NULL) /* if filter is NULL, then return ALL networkAddress */ - xstrncpy(ft, "(&(objectClass=User)(networkAddress=*))", sizeof(ft)); - else - xstrncpy(ft, filter, sizeof(ft)); + xstrncpy(ft, filter, sizeof(ft)); /* We have a binded connection, with a free l->lm, so let's get this done */ switch (scope) { @@ -1408,14 +1405,6 @@ SearchIPLDAP(edui_ldap_t *l) ldap_value_free_len(l->val); l->val = NULL; } - if (ber != NULL) { - ldap_value_free_len(ber); - ber = NULL; - } - if (ent != NULL) { - ldap_msgfree(ent); - ent = NULL; - } if (l->lm != NULL) { ldap_msgfree(l->lm); l->lm = NULL; -- 2.47.2