diff options
author | Volker Lendecke <vlendec@samba.org> | 2003-07-18 09:05:30 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2003-07-18 09:05:30 +0000 |
commit | 922ec277d1c80b5532f5cac0ee99ae7cd20f83f1 (patch) | |
tree | 5c216bddddf896eb25a6bfcc8d7c7098cce54b67 /source/passdb | |
parent | 2fd5569938b8970f3e9d761eecad5bc0b8bb267e (diff) | |
download | samba-922ec277d1c80b5532f5cac0ee99ae7cd20f83f1.tar.gz samba-922ec277d1c80b5532f5cac0ee99ae7cd20f83f1.tar.xz samba-922ec277d1c80b5532f5cac0ee99ae7cd20f83f1.zip |
Fix two memleaks in pdb_ldap.c.
Whoever put the private.backend_private_data_free_fn thingy into
SAM_ACCOUNT, could you please revisit my change to pdb_get_set.c and
comment on my comment there?
Thanks,
Volker
Diffstat (limited to 'source/passdb')
-rw-r--r-- | source/passdb/pdb_get_set.c | 9 | ||||
-rw-r--r-- | source/passdb/pdb_ldap.c | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/source/passdb/pdb_get_set.c b/source/passdb/pdb_get_set.c index ba07a4e01c8..15054585512 100644 --- a/source/passdb/pdb_get_set.c +++ b/source/passdb/pdb_get_set.c @@ -1027,9 +1027,18 @@ BOOL pdb_set_backend_private_data (SAM_ACCOUNT *sampass, void *private_data, if (!sampass) return False; +#if 0 + /* With this check backend_private_data_free_fn is *never* set + as the methods are never set anywhere. What is this + supposed to do ???? + + Volker + */ + /* does this backend 'own' this SAM_ACCOUNT? */ if (my_methods != sampass->private.backend_private_methods) return False; +#endif if (sampass->private.backend_private_data && sampass->private.backend_private_data_free_fn) { sampass->private.backend_private_data_free_fn(&sampass->private.backend_private_data); diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c index 84ac6c576a8..8f5efbbd648 100644 --- a/source/passdb/pdb_ldap.c +++ b/source/passdb/pdb_ldap.c @@ -104,7 +104,7 @@ struct ldapsam_privates { static void private_data_free_fn(void **result) { - ldap_memfree(*result); + ldap_msgfree(*result); *result = NULL; } @@ -1377,6 +1377,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A if (!init_ldap_from_sam(ldap_state, entry, &mods, newpwd, element_is_changed)) { DEBUG(0, ("ldapsam_update_sam_account: init_ldap_from_sam failed!\n")); + ldap_memfree(dn); return NT_STATUS_UNSUCCESSFUL; } @@ -1384,11 +1385,13 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A DEBUG(4,("mods is empty: nothing to update for user: %s\n", pdb_get_username(newpwd))); ldap_mods_free(mods, True); + ldap_memfree(dn); return NT_STATUS_OK; } ret = ldapsam_modify_entry(my_methods,newpwd,dn,mods,LDAP_MOD_REPLACE, element_is_changed); ldap_mods_free(mods,True); + ldap_memfree(dn); if (!NT_STATUS_IS_OK(ret)) { char *ld_error = NULL; |