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/smbd/close.c | 4 ++-- source3/smbd/conn.c | 2 +- source3/smbd/lanman.c | 4 ++-- source3/smbd/open.c | 24 ++++++++++++------------ source3/smbd/oplock.c | 16 ++++++++-------- source3/smbd/password.c | 10 +++++----- source3/smbd/process.c | 16 ++++++++-------- source3/smbd/reply.c | 10 +++++----- source3/smbd/sec_ctx.c | 6 +++--- source3/smbd/server.c | 2 +- source3/smbd/service.c | 6 +++--- source3/smbd/share_access.c | 4 ++-- source3/smbd/uid.c | 4 ++-- 13 files changed, 54 insertions(+), 54 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 059b88ecc8..09276cd200 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -288,7 +288,7 @@ static int close_normal_file(files_struct *fsp, enum file_close_type close_type) process_pending_change_notify_queue((time_t)0); } - talloc_free(lck); + TALLOC_FREE(lck); if(fsp->oplock_type) release_file_oplock(fsp); @@ -363,7 +363,7 @@ static int close_directory(files_struct *fsp, enum file_close_type close_type) delete_dir = (lck->delete_on_close | lck->initial_delete_on_close); - talloc_free(lck); + TALLOC_FREE(lck); if ((close_type == NORMAL_CLOSE || close_type == SHUTDOWN_CLOSE) && delete_dir && diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index bf4db99ea6..b41467f02c 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -249,7 +249,7 @@ void conn_free_internal(connection_struct *conn) } if (conn->nt_user_token) { - talloc_free(conn->nt_user_token); + TALLOC_FREE(conn->nt_user_token); } free_namearray(conn->veto_list); diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index a2ec6f34b8..3f10ba41b2 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -2026,7 +2026,7 @@ static BOOL api_NetUserGetGroups(connection_struct *conn,uint16 vuid, char *para done: unbecome_root(); /* END ROOT BLOCK */ - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return ret; } @@ -2219,7 +2219,7 @@ static BOOL api_SetUserPassword(connection_struct *conn,uint16 vuid, char *param } unbecome_root(); - talloc_free(server_info); + TALLOC_FREE(server_info); } data_blob_clear_free(&password); } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 3e555a8f31..258e0e6021 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1352,7 +1352,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, &state); } - talloc_free(lck); + TALLOC_FREE(lck); return NULL; } @@ -1363,7 +1363,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, if (NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) { /* DELETE_PENDING is not deferred for a second */ set_saved_ntstatus(status); - talloc_free(lck); + TALLOC_FREE(lck); file_free(fsp); return NULL; } @@ -1384,7 +1384,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, create_options); if (fsp_dup) { - talloc_free(lck); + TALLOC_FREE(lck); file_free(fsp); if (pinfo) { *pinfo = FILE_WAS_OPENED; @@ -1447,7 +1447,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, } } - talloc_free(lck); + TALLOC_FREE(lck); if (fsp_open) { fd_close(conn, fsp); /* @@ -1490,7 +1490,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, if (!fsp_open) { if (lck != NULL) { - talloc_free(lck); + TALLOC_FREE(lck); } file_free(fsp); return NULL; @@ -1551,7 +1551,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, defer_open(lck, request_time, timeval_zero(), &state); - talloc_free(lck); + TALLOC_FREE(lck); return NULL; } @@ -1588,7 +1588,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, */ if ((SMB_VFS_FTRUNCATE(fsp,fsp->fh->fd,0) == -1) || (SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf)==-1)) { - talloc_free(lck); + TALLOC_FREE(lck); fd_close(conn,fsp); file_free(fsp); return NULL; @@ -1643,7 +1643,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, if (!NT_STATUS_IS_OK(result)) { /* Remember to delete the mode we just added. */ del_share_mode(lck, fsp); - talloc_free(lck); + TALLOC_FREE(lck); fd_close(conn,fsp); file_free(fsp); set_saved_ntstatus(result); @@ -1712,7 +1712,7 @@ files_struct *open_file_ntcreate(connection_struct *conn, /* If this is a successful open, we must remove any deferred open * records. */ del_deferred_open_entry(lck, mid); - talloc_free(lck); + TALLOC_FREE(lck); conn->num_files_open++; @@ -1933,7 +1933,7 @@ files_struct *open_directory(connection_struct *conn, if (!NT_STATUS_IS_OK(status)) { set_saved_ntstatus(status); - talloc_free(lck); + TALLOC_FREE(lck); file_free(fsp); return NULL; } @@ -1946,7 +1946,7 @@ files_struct *open_directory(connection_struct *conn, status = can_set_delete_on_close(fsp, True, 0); if (!NT_STATUS_IS_OK(status)) { set_saved_ntstatus(status); - talloc_free(lck); + TALLOC_FREE(lck); file_free(fsp); return NULL; } @@ -1956,7 +1956,7 @@ files_struct *open_directory(connection_struct *conn, lck->modified = True; } - talloc_free(lck); + TALLOC_FREE(lck); /* Change the owner if required. */ if ((info == FILE_WAS_CREATED) && lp_inherit_owner(SNUM(conn))) { diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 3efd630649..7d0a94efda 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -197,7 +197,7 @@ BOOL remove_oplock(files_struct *fsp) (double)inode)); } release_file_oplock(fsp); - talloc_free(lck); + TALLOC_FREE(lck); return ret; } @@ -226,7 +226,7 @@ BOOL downgrade_oplock(files_struct *fsp) } downgrade_file_oplock(fsp); - talloc_free(lck); + TALLOC_FREE(lck); return ret; } @@ -470,7 +470,7 @@ static void process_oplock_async_level2_break_message(int msg_type, struct proce /* Restore the sign state to what it was. */ srv_oplock_set_signing(sign_state); - talloc_free(break_msg); + TALLOC_FREE(break_msg); /* Async level2 request, don't send a reply, just remove the oplock. */ remove_oplock(fsp); @@ -578,7 +578,7 @@ static void process_oplock_break_message(int msg_type, struct process_id src, /* Restore the sign state to what it was. */ srv_oplock_set_signing(sign_state); - talloc_free(break_msg); + TALLOC_FREE(break_msg); fsp->sent_oplock_break = break_to_level2 ? LEVEL_II_BREAK_SENT:BREAK_TO_NONE_SENT; @@ -654,7 +654,7 @@ static void process_kernel_oplock_break(int msg_type, struct process_id src, /* Restore the sign state to what it was. */ srv_oplock_set_signing(sign_state); - talloc_free(break_msg); + TALLOC_FREE(break_msg); fsp->sent_oplock_break = BREAK_TO_NONE_SENT; @@ -681,7 +681,7 @@ void reply_to_oplock_break_requests(files_struct *fsp) fsp->num_pending_break_messages = 0; if (fsp->oplock_timeout != NULL) { /* Remove the timed event handler. */ - talloc_free(fsp->oplock_timeout); + TALLOC_FREE(fsp->oplock_timeout); fsp->oplock_timeout = NULL; } return; @@ -801,7 +801,7 @@ void release_level_2_oplocks_on_change(files_struct *fsp) DEBUG(0,("release_level_2_oplocks_on_change: PANIC. " "share mode entry %d is an exlusive " "oplock !\n", i )); - talloc_free(lck); + TALLOC_FREE(lck); abort(); } @@ -816,7 +816,7 @@ void release_level_2_oplocks_on_change(files_struct *fsp) /* We let the message receivers handle removing the oplock state in the share mode lock db. */ - talloc_free(lck); + TALLOC_FREE(lck); } /**************************************************************************** diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 0eeb537ded..782a8c2b89 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -100,7 +100,7 @@ void invalidate_vuid(uint16 vuid) session_yield(vuser); SAFE_FREE(vuser->session_keystr); - talloc_free(vuser->server_info); + TALLOC_FREE(vuser->server_info); data_blob_free(&vuser->session_key); @@ -111,7 +111,7 @@ void invalidate_vuid(uint16 vuid) conn_clear_vuid_cache(vuid); SAFE_FREE(vuser->groups); - talloc_free(vuser->nt_user_token); + TALLOC_FREE(vuser->nt_user_token); SAFE_FREE(vuser); num_validated_vuids--; } @@ -215,7 +215,7 @@ int register_vuid(auth_serversupplied_info *server_info, "vuser->groups\n")); data_blob_free(&session_key); free(vuser); - talloc_free(server_info); + TALLOC_FREE(server_info); return UID_FIELD_INVALID; } } @@ -252,7 +252,7 @@ int register_vuid(auth_serversupplied_info *server_info, if (passwd) { vuser->unix_homedir = smb_xstrdup(passwd->pw_dir); - talloc_free(passwd); + TALLOC_FREE(passwd); } } @@ -280,7 +280,7 @@ int register_vuid(auth_serversupplied_info *server_info, } else { DEBUG(1, ("server_info does not contain a user_token - " "cannot continue\n")); - talloc_free(server_info); + TALLOC_FREE(server_info); data_blob_free(&session_key); SAFE_FREE(vuser->homedir); SAFE_FREE(vuser->unix_homedir); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 9d35252e28..a50323887a 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -91,7 +91,7 @@ static BOOL push_queued_message(char *buf, int msg_len, msg->buf = data_blob_talloc(msg, buf, msg_len); if(msg->buf.data == NULL) { DEBUG(0,("push_message: malloc fail (2)\n")); - talloc_free(msg); + TALLOC_FREE(msg); return False; } @@ -103,7 +103,7 @@ static BOOL push_queued_message(char *buf, int msg_len, private_len); if (msg->private_data.data == NULL) { DEBUG(0,("push_message: malloc fail (3)\n")); - talloc_free(msg); + TALLOC_FREE(msg); return False; } } @@ -131,7 +131,7 @@ void remove_deferred_open_smb_message(uint16 mid) (unsigned int)mid, (unsigned int)pml->buf.length )); DLIST_REMOVE(deferred_open_queue, pml); - talloc_free(pml); + TALLOC_FREE(pml); return; } } @@ -237,11 +237,11 @@ static void idle_event_handler(struct timed_event *te, struct idle_event *event = talloc_get_type_abort(private_data, struct idle_event); - talloc_free(event->te); + TALLOC_FREE(event->te); if (!event->handler(now, event->private_data)) { /* Don't repeat, delete ourselves */ - talloc_free(event); + TALLOC_FREE(event); return; } @@ -277,7 +277,7 @@ struct idle_event *add_idle_event(TALLOC_CTX *mem_ctx, idle_event_handler, result); if (result->te == NULL) { DEBUG(0, ("add_timed_event failed\n")); - talloc_free(result); + TALLOC_FREE(result); return NULL; } @@ -1623,8 +1623,8 @@ void smbd_process(void) errno = 0; /* free up temporary memory */ - lp_talloc_free(); - main_loop_talloc_free(); + lp_TALLOC_FREE(); + main_loop_TALLOC_FREE(); /* Did someone ask for immediate checks on things like blocking locks ? */ if (select_timeout == 0) { diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 89b98be1e7..1ca9d39a4c 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -4263,11 +4263,11 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, char * DEBUG(3,("rename_internals_fsp: succeeded doing rename on %s -> %s\n", fsp->fsp_name,newname)); rename_open_files(conn, lck, fsp->dev, fsp->inode, newname); - talloc_free(lck); + TALLOC_FREE(lck); return NT_STATUS_OK; } - talloc_free(lck); + TALLOC_FREE(lck); if (errno == ENOTDIR || errno == EISDIR) { error = NT_STATUS_OBJECT_NAME_COLLISION; @@ -4492,11 +4492,11 @@ directory = %s, newname = %s, last_component_dest = %s, is_8_3 = %d\n", DEBUG(3,("rename_internals: succeeded doing rename on %s -> %s\n", directory,newname)); rename_open_files(conn, lck, sbuf1.st_dev, sbuf1.st_ino, newname); - talloc_free(lck); + TALLOC_FREE(lck); return NT_STATUS_OK; } - talloc_free(lck); + TALLOC_FREE(lck); if (errno == ENOTDIR || errno == EISDIR) error = NT_STATUS_OBJECT_NAME_COLLISION; else @@ -4599,7 +4599,7 @@ directory = %s, newname = %s, last_component_dest = %s, is_8_3 = %d\n", count++; error = NT_STATUS_OK; } - talloc_free(lck); + TALLOC_FREE(lck); DEBUG(3,("rename_internals: doing rename on %s -> %s\n",fname,destname)); } CloseDir(dir_hnd); diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c index ebc47c51d9..a30123bfa7 100644 --- a/source3/smbd/sec_ctx.c +++ b/source3/smbd/sec_ctx.c @@ -215,7 +215,7 @@ BOOL push_sec_ctx(void) if (ctx_p->ut.ngroups != 0) { if (!(ctx_p->ut.groups = SMB_MALLOC_ARRAY(gid_t, ctx_p->ut.ngroups))) { DEBUG(0, ("Out of memory in push_sec_ctx()\n")); - talloc_free(ctx_p->token); + TALLOC_FREE(ctx_p->token); return False; } @@ -255,7 +255,7 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, NT_USER_TOKEN if (token && (token == ctx_p->token)) smb_panic("DUPLICATE_TOKEN"); - talloc_free(ctx_p->token); + TALLOC_FREE(ctx_p->token); ctx_p->ut.groups = memdup(groups, sizeof(gid_t) * ngroups); ctx_p->token = dup_nt_token(NULL, token); @@ -311,7 +311,7 @@ BOOL pop_sec_ctx(void) SAFE_FREE(ctx_p->ut.groups); ctx_p->ut.ngroups = 0; - talloc_free(ctx_p->token); + TALLOC_FREE(ctx_p->token); /* Pop back previous user */ diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 6c2034988a..2e96b4ceb9 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -353,7 +353,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_ int num; /* Free up temporary memory from the main smbd. */ - lp_talloc_free(); + lp_TALLOC_FREE(); /* Ensure we respond to PING and DEBUG messages from the main smbd. */ message_dispatch(); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 0fce677ea9..5c4974329c 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -399,7 +399,7 @@ static NTSTATUS find_forced_user(int snum, BOOL vuser_is_guest, result = NT_STATUS_OK; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } @@ -487,7 +487,7 @@ static NTSTATUS find_forced_group(BOOL force_user, result = NT_STATUS_OK; done: - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return result; } @@ -540,7 +540,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, conn->uid = pass->pw_uid; conn->gid = pass->pw_gid; string_set(&conn->user,pass->pw_name); - talloc_free(pass); + TALLOC_FREE(pass); DEBUG(3,("Guest only user %s\n",user)); } else if (vuser) { if (vuser->guest) { diff --git a/source3/smbd/share_access.c b/source3/smbd/share_access.c index 11e52b03ab..a429937f8d 100644 --- a/source3/smbd/share_access.c +++ b/source3/smbd/share_access.c @@ -161,13 +161,13 @@ BOOL token_contains_name_in_list(const char *username, while (*list != NULL) { if (token_contains_name(mem_ctx, username, sharename, token, *list)) { - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return True; } list += 1; } - talloc_free(mem_ctx); + TALLOC_FREE(mem_ctx); return False; } diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 6e516d3562..c62c9d928a 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -72,7 +72,7 @@ BOOL change_to_guest(void) current_user.conn = NULL; current_user.vuid = UID_FIELD_INVALID; - talloc_free(pass); + TALLOC_FREE(pass); pass = NULL; return True; @@ -251,7 +251,7 @@ BOOL change_to_user(connection_struct *conn, uint16 vuid) */ if (must_free_token) - talloc_free(token); + TALLOC_FREE(token); current_user.conn = conn; current_user.vuid = vuid; -- cgit