From c61a230c5ab7250c0812b422e0a533fbf5efbf17 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 31 Oct 2003 19:16:59 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20from=20Aur=E9lien=20Degr=E9mont=20.=20"entry"=20is=20dependent=20on=20"result",?= =?UTF-8?q?=20don't=20free=20result=20first.=20Jeremy.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/passdb/pdb_ldap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c index e0148494d33..9299ca2e50e 100644 --- a/source/passdb/pdb_ldap.c +++ b/source/passdb/pdb_ldap.c @@ -1983,21 +1983,22 @@ static NTSTATUS ldapsam_update_group_mapping_entry(struct pdb_methods *methods, return NT_STATUS_UNSUCCESSFUL; } - ldap_msgfree(result); - if (mods == NULL) { DEBUG(4, ("ldapsam_update_group_mapping_entry: mods is empty: nothing to do\n")); + ldap_msgfree(result); return NT_STATUS_OK; } dn = smbldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); if (!dn) { + ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; } rc = smbldap_modify(ldap_state->smbldap_state, dn, mods); SAFE_FREE(dn); ldap_mods_free(mods, True); + ldap_msgfree(result); if (rc != LDAP_SUCCESS) { char *ld_error = NULL; @@ -2006,6 +2007,7 @@ static NTSTATUS ldapsam_update_group_mapping_entry(struct pdb_methods *methods, DEBUG(0, ("ldapsam_update_group_mapping_entry: failed to modify group %lu error: %s (%s)\n", (unsigned long)map->gid, ld_error ? ld_error : "(unknown)", ldap_err2string(rc))); SAFE_FREE(ld_error); + return NT_STATUS_UNSUCCESSFUL; } DEBUG(2, ("ldapsam_update_group_mapping_entry: successfully modified group %lu in LDAP\n", (unsigned long)map->gid));