From fb5362c069b5b6548478b2217a0519c56d856705 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 20 Feb 2006 17:59:58 +0000 Subject: r13571: Replace all calls to talloc_free() with thye TALLOC_FREE() macro which sets the freed pointer to NULL. (This used to be commit b65be8874a2efe5a4b167448960a4fcf6bd995e2) --- source3/passdb/lookup_sid.c | 10 ++++----- source3/passdb/passdb.c | 2 +- source3/passdb/pdb_interface.c | 4 ++-- source3/passdb/pdb_ldap.c | 48 +++++++++++++++++++++--------------------- source3/passdb/pdb_nds.c | 2 +- source3/passdb/pdb_smbpasswd.c | 4 ++-- source3/passdb/secrets.c | 22 +++++++++---------- source3/passdb/util_unixsids.c | 2 +- 8 files changed, 47 insertions(+), 47 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index 6266aa9cab..f6eb1e7baa 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -265,13 +265,13 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx, } failed: - talloc_free(tmp_ctx); + TALLOC_FREE(tmp_ctx); return False; ok: if ((domain == NULL) || (name == NULL)) { DEBUG(0, ("talloc failed\n")); - talloc_free(tmp_ctx); + TALLOC_FREE(tmp_ctx); return False; } @@ -293,7 +293,7 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx, *ret_type = type; } - talloc_free(tmp_ctx); + TALLOC_FREE(tmp_ctx); return True; } @@ -746,7 +746,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, result = NT_STATUS_OK; done: - talloc_free(tmp_ctx); + TALLOC_FREE(tmp_ctx); return result; } @@ -802,7 +802,7 @@ BOOL lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, DEBUG(10, ("failed to lookup sid %s\n", sid_string_static(sid))); } - talloc_free(tmp_ctx); + TALLOC_FREE(tmp_ctx); return ret; } diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index a50afb6bb8..97cccbf2a5 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -484,7 +484,7 @@ NTSTATUS pdb_init_sam_new(SAM_ACCOUNT **new_sam_acct, const char *username) pdb_free_sam(new_sam_acct); } - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index f42ff3a725..e2035296cc 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -1380,7 +1380,7 @@ static BOOL pdb_default_sid_to_id(struct pdb_methods *methods, done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return ret; } @@ -1531,7 +1531,7 @@ NTSTATUS pdb_default_enum_group_memberships(struct pdb_methods *methods, *pp_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, *p_num_groups); if (*pp_sids == NULL) { - talloc_free(*pp_gids); + TALLOC_FREE(*pp_gids); return NT_STATUS_NO_MEMORY; } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 24a7304f87..9abd668d6f 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1353,7 +1353,7 @@ static NTSTATUS ldapsam_setsampwent(struct pdb_methods *my_methods, BOOL update, attr_list = get_userattr_list(NULL, ldap_state->schema_ver); rc = smbldap_search(ldap_state->smbldap_state, suffix, LDAP_SCOPE_SUBTREE, filter, attr_list, 0, &ldap_state->result); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if (rc != LDAP_SUCCESS) { DEBUG(0, ("ldapsam_setsampwent: LDAP search failed: %s\n", ldap_err2string(rc))); @@ -1454,7 +1454,7 @@ static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT append_attr(user->mem_ctx, &attr_list, "uidNumber"); rc = ldapsam_search_suffix_by_name(ldap_state, sname, &result, attr_list); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if ( rc != LDAP_SUCCESS ) return NT_STATUS_NO_SUCH_USER; @@ -1511,7 +1511,7 @@ static int ldapsam_get_ldap_user_by_sid(struct ldapsam_privates *ldap_state, append_attr(tmp_ctx, &attr_list, "uidNumber"); rc = ldapsam_search_suffix_by_sid(ldap_state, sid, result, attr_list); - talloc_free(tmp_ctx); + TALLOC_FREE(tmp_ctx); if ( rc != LDAP_SUCCESS ) return rc; @@ -1526,7 +1526,7 @@ static int ldapsam_get_ldap_user_by_sid(struct ldapsam_privates *ldap_state, attr_list = get_userattr_list(NULL, ldap_state->schema_ver); rc = ldapsam_search_suffix_by_rid(ldap_state, rid, result, attr_list ); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if ( rc != LDAP_SUCCESS ) return rc; @@ -1783,7 +1783,7 @@ static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods, NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } @@ -1817,7 +1817,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A if (!result) { attr_list = get_userattr_list(NULL, ldap_state->schema_ver); rc = ldapsam_search_suffix_by_name(ldap_state, pdb_get_username(newpwd), &result, attr_list ); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if (rc != LDAP_SUCCESS) { return NT_STATUS_UNSUCCESSFUL; } @@ -1959,7 +1959,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO rc = ldapsam_search_suffix_by_name (ldap_state, username, &result, attr_list); if (rc != LDAP_SUCCESS) { - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); return NT_STATUS_UNSUCCESSFUL; } @@ -1967,7 +1967,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO DEBUG(0,("ldapsam_add_sam_account: User '%s' already in the base, with samba attributes\n", username)); ldap_msgfree(result); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); return NT_STATUS_UNSUCCESSFUL; } ldap_msgfree(result); @@ -1980,7 +1980,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO if (ldap_count_entries(ldap_state->smbldap_state->ldap_struct, result) != 0) { DEBUG(0,("ldapsam_add_sam_account: SID '%s' already in the base, with samba attributes\n", sid_to_string(sid_string, sid))); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; } @@ -1999,7 +1999,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO rc = smbldap_search_suffix(ldap_state->smbldap_state, filter, attr_list, &result); if ( rc != LDAP_SUCCESS ) { - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); return NT_STATUS_UNSUCCESSFUL; } @@ -2007,7 +2007,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO if (num_result > 1) { DEBUG (0, ("ldapsam_add_sam_account: More than one user with that uid exists: bailing out!\n")); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; } @@ -2021,7 +2021,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO entry = ldap_first_entry (ldap_state->smbldap_state->ldap_struct, result); tmp = smbldap_get_dn (ldap_state->smbldap_state->ldap_struct, entry); if (!tmp) { - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; } @@ -2047,7 +2047,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO filter, attr_list, &result); if ( rc != LDAP_SUCCESS ) { - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); return NT_STATUS_UNSUCCESSFUL; } @@ -2055,7 +2055,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO if (num_result > 1) { DEBUG (0, ("ldapsam_add_sam_account: More than one user with that uid exists: bailing out!\n")); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; } @@ -2069,7 +2069,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO entry = ldap_first_entry (ldap_state->smbldap_state->ldap_struct, result); tmp = smbldap_get_dn (ldap_state->smbldap_state->ldap_struct, entry); if (!tmp) { - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; } @@ -2078,7 +2078,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO } } - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if (num_result == 0) { /* Check if we need to add an entry */ @@ -2147,7 +2147,7 @@ static int ldapsam_search_one_group (struct ldapsam_privates *ldap_state, rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_group_suffix (), scope, filter, attr_list, 0, result); - talloc_free(attr_list); + TALLOC_FREE(attr_list); return rc; } @@ -2862,7 +2862,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods, NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } @@ -2950,7 +2950,7 @@ static NTSTATUS ldapsam_update_group_mapping_entry(struct pdb_methods *methods, result = NT_STATUS_OK; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } @@ -3029,7 +3029,7 @@ static NTSTATUS ldapsam_delete_group_mapping_entry(struct pdb_methods *methods, result = (rc == LDAP_SUCCESS) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } @@ -3050,7 +3050,7 @@ static NTSTATUS ldapsam_setsamgrent(struct pdb_methods *my_methods, rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_group_suffix(), LDAP_SCOPE_SUBTREE, filter, attr_list, 0, &ldap_state->result); - talloc_free(attr_list); + TALLOC_FREE(attr_list); if (rc != LDAP_SUCCESS) { DEBUG(0, ("ldapsam_setsamgrent: LDAP search failed: %s\n", @@ -3871,7 +3871,7 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods, result = (num_mapped == num_rids) ? NT_STATUS_OK : STATUS_SOME_UNMAPPED; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } @@ -4495,7 +4495,7 @@ static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv, *rid = nextRid; } - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return status; } @@ -4605,7 +4605,7 @@ static BOOL ldapsam_sid_to_id(struct pdb_methods *methods, ret = True; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return ret; } diff --git a/source3/passdb/pdb_nds.c b/source3/passdb/pdb_nds.c index d5636d6812..4bbdeb4dbb 100644 --- a/source3/passdb/pdb_nds.c +++ b/source3/passdb/pdb_nds.c @@ -774,7 +774,7 @@ static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods, attr_list = get_userattr_list(NULL, ldap_state->schema_ver); rc = ldapsam_search_suffix_by_name(ldap_state, username, &result, attr_list ); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if (rc != LDAP_SUCCESS) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 7839860bf4..1837b4fcee 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1161,7 +1161,7 @@ static BOOL build_smb_pass (struct smb_passwd *smb_pw, const SAM_ACCOUNT *sampas return False; } smb_pw->smb_userid=passwd->pw_uid; - talloc_free(passwd); + TALLOC_FREE(passwd); } else if (algorithmic_pdb_rid_is_user(rid)) { smb_pw->smb_userid=algorithmic_pdb_user_rid_to_uid(rid); } else { @@ -1206,7 +1206,7 @@ static BOOL build_sam_account(struct smbpasswd_privates *smbpasswd_state, if (!NT_STATUS_IS_OK(pdb_fill_sam_pw(sam_pass, pwfile))) return False; - talloc_free(pwfile); + TALLOC_FREE(pwfile); /* set remaining fields */ diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index ece17cc718..bb4aad9fac 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -892,7 +892,7 @@ static TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx) if (!tdb_sc) { DEBUG(0,("open_schannel_session_store: Failed to open %s\n", fname)); - talloc_free(fname); + TALLOC_FREE(fname); return NULL; } @@ -920,7 +920,7 @@ static TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx) } SAFE_FREE(vers.dptr); - talloc_free(fname); + TALLOC_FREE(fname); return tdb_sc; } @@ -959,7 +959,7 @@ BOOL secrets_store_schannel_session_info(TALLOC_CTX *mem_ctx, value.dptr = TALLOC(mem_ctx, value.dsize); if (!value.dptr) { - talloc_free(keystr); + TALLOC_FREE(keystr); return False; } @@ -976,8 +976,8 @@ BOOL secrets_store_schannel_session_info(TALLOC_CTX *mem_ctx, tdb_sc = open_schannel_session_store(mem_ctx); if (!tdb_sc) { - talloc_free(keystr); - talloc_free(value.dptr); + TALLOC_FREE(keystr); + TALLOC_FREE(value.dptr); return False; } @@ -987,8 +987,8 @@ BOOL secrets_store_schannel_session_info(TALLOC_CTX *mem_ctx, keystr )); tdb_close(tdb_sc); - talloc_free(keystr); - talloc_free(value.dptr); + TALLOC_FREE(keystr); + TALLOC_FREE(value.dptr); return ret; } @@ -1024,7 +1024,7 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx, tdb_sc = open_schannel_session_store(mem_ctx); if (!tdb_sc) { - talloc_free(keystr); + TALLOC_FREE(keystr); return False; } @@ -1055,8 +1055,8 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx, if (ret == -1 || l1 != 8 || l2 != 8 || l3 != 8 || l4 != 16 || l5 != 16) { /* Bad record - delete it. */ tdb_delete_bystring(tdb_sc, keystr); - talloc_free(keystr); - talloc_free(pdc); + TALLOC_FREE(keystr); + TALLOC_FREE(pdc); SAFE_FREE(pseed_chal); SAFE_FREE(pclnt_chal); SAFE_FREE(psrv_chal); @@ -1085,7 +1085,7 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx, SAFE_FREE(psess_key); SAFE_FREE(pmach_pw); - talloc_free(keystr); + TALLOC_FREE(keystr); SAFE_FREE(value.dptr); *ppdc = pdc; diff --git a/source3/passdb/util_unixsids.c b/source3/passdb/util_unixsids.c index ee8cf2d8f0..2a4818e3ae 100644 --- a/source3/passdb/util_unixsids.c +++ b/source3/passdb/util_unixsids.c @@ -53,7 +53,7 @@ BOOL lookup_unix_user_name(const char *name, DOM_SID *sid) sid_copy(sid, &global_sid_Unix_Users); sid_append_rid(sid, pwd->pw_uid); /* For 64-bit uid's we have enough * space ... */ - talloc_free(pwd); + TALLOC_FREE(pwd); return True; } -- cgit