diff --git a/server/atom.c b/server/atom.c index 889193504a1..8c190a40de0 100644 --- a/server/atom.c +++ b/server/atom.c @@ -196,7 +196,7 @@ static void atom_table_destroy( struct object *obj ) for (i = 0; i <= table->last; i++) free( table->handles[i] ); free( table->handles ); } - if (table->entries) free( table->entries ); + free( table->entries ); } /* find an atom entry in its hash list */ diff --git a/server/change.c b/server/change.c index 01833ddd0a6..e046181dbae 100644 --- a/server/change.c +++ b/server/change.c @@ -474,8 +474,7 @@ static void inode_set_wd( struct inode *inode, int wd ) static void inode_set_name( struct inode *inode, const char *name ) { - if (inode->name) - free (inode->name); + free (inode->name); inode->name = name ? strdup( name ) : NULL; } diff --git a/server/console.c b/server/console.c index f57e4fe9ac4..65902586a06 100644 --- a/server/console.c +++ b/server/console.c @@ -633,7 +633,7 @@ static int set_console_input_info( const struct set_console_input_info_request * { memcpy( new_title, title, len ); new_title[len / sizeof(WCHAR)] = 0; - if (console->title) free( console->title ); + free( console->title ); console->title = new_title; evt.event = CONSOLE_RENDERER_TITLE_EVENT; console_input_events_append( console->evt, &evt ); @@ -963,8 +963,8 @@ static void console_input_destroy( struct object *obj ) int i; assert( obj->ops == &console_input_ops ); - if (console_in->title) free( console_in->title ); - if (console_in->records) free( console_in->records ); + free( console_in->title ); + free( console_in->records ); if (console_in->active) release_object( console_in->active ); console_in->active = NULL; @@ -980,7 +980,7 @@ static void console_input_destroy( struct object *obj ) for (i = 0; i < console_in->history_size; i++) if (console_in->history[i]) free( console_in->history[i] ); - if (console_in->history) free( console_in->history ); + free( console_in->history ); } static void screen_buffer_dump( struct object *obj, int verbose ) @@ -1013,7 +1013,7 @@ static void screen_buffer_destroy( struct object *obj ) } } } - if (screen_buffer->data) free( screen_buffer->data ); + free( screen_buffer->data ); } /* write data into a screen buffer */ diff --git a/server/hook.c b/server/hook.c index e8a72a819f3..8e0a797eca5 100644 --- a/server/hook.c +++ b/server/hook.c @@ -149,7 +149,7 @@ static struct hook *add_hook( struct desktop *desktop, struct thread *thread, in static void free_hook( struct hook *hook ) { free_user_handle( hook->handle ); - if (hook->module) free( hook->module ); + free( hook->module ); if (hook->thread) { assert( hook->thread->desktop_users > 0 ); @@ -437,7 +437,7 @@ DECL_HANDLER(set_hook) reply->handle = hook->handle; reply->active_hooks = get_active_hooks(); } - else if (module) free( module ); + else free( module ); done: if (process) release_object( process ); diff --git a/server/mailslot.c b/server/mailslot.c index 4ae575837b1..6c4fc1c3d4f 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -305,7 +305,7 @@ static void mailslot_device_destroy( struct object *obj ) struct mailslot_device *device = (struct mailslot_device*)obj; assert( obj->ops == &mailslot_device_ops ); if (device->fd) release_object( device->fd ); - if (device->mailslots) free( device->mailslots ); + free( device->mailslots ); } static int mailslot_device_get_file_info( struct fd *fd ) diff --git a/server/mapping.c b/server/mapping.c index 02f6d48bc51..212af1bea36 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -196,7 +196,7 @@ static int build_shared_mapping( struct mapping *mapping, int fd, error: release_object( mapping->shared_file ); mapping->shared_file = NULL; - if (buffer) free( buffer ); + free( buffer ); return 0; } @@ -254,7 +254,7 @@ static int get_image_params( struct mapping *mapping ) return 1; error: - if (sec) free( sec ); + free( sec ); release_object( fd ); set_error( STATUS_INVALID_FILE_FOR_SECTION ); return 0; diff --git a/server/named_pipe.c b/server/named_pipe.c index 4b68fa07e8d..9edd1061c51 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -435,7 +435,7 @@ static void named_pipe_device_destroy( struct object *obj ) struct named_pipe_device *device = (struct named_pipe_device*)obj; assert( obj->ops == &named_pipe_device_ops ); if (device->fd) release_object( device->fd ); - if (device->pipes) free( device->pipes ); + free( device->pipes ); } static int named_pipe_device_get_file_info( struct fd *fd ) diff --git a/server/process.c b/server/process.c index c50641b5e76..cc4fd6f715b 100644 --- a/server/process.c +++ b/server/process.c @@ -417,7 +417,7 @@ static void startup_info_destroy( struct object *obj ) { struct startup_info *info = (struct startup_info *)obj; assert( obj->ops == &startup_info_ops ); - if (info->data) free( info->data ); + free( info->data ); if (info->exe_file) release_object( info->exe_file ); if (info->process) release_object( info->process ); } @@ -504,7 +504,7 @@ static void process_unload_dll( struct process *process, void *base ) if (dll && (&dll->entry != list_head( &process->dlls ))) /* main exe can't be unloaded */ { if (dll->file) release_object( dll->file ); - if (dll->filename) free( dll->filename ); + free( dll->filename ); list_remove( &dll->entry ); free( dll ); generate_debug_event( current, UNLOAD_DLL_DEBUG_EVENT, base ); @@ -582,7 +582,7 @@ static void process_killed( struct process *process ) { struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry ); if (dll->file) release_object( dll->file ); - if (dll->filename) free( dll->filename ); + free( dll->filename ); list_remove( &dll->entry ); free( dll ); } diff --git a/server/queue.c b/server/queue.c index 37cc250d8e4..cf7d10e1134 100644 --- a/server/queue.c +++ b/server/queue.c @@ -404,7 +404,7 @@ static int merge_message( struct thread_input *input, const struct message *msg static void free_result( struct message_result *result ) { if (result->timeout) remove_timeout_user( result->timeout ); - if (result->data) free( result->data ); + free( result->data ); if (result->callback_msg) free_message( result->callback_msg ); free( result ); } @@ -467,7 +467,7 @@ static void free_message( struct message *msg ) } else free_result( result ); } - if (msg->data) free( msg->data ); + free( msg->data ); free( msg ); } diff --git a/server/registry.c b/server/registry.c index 93d69def185..ce15503364e 100644 --- a/server/registry.c +++ b/server/registry.c @@ -327,20 +327,20 @@ static void key_destroy( struct object *obj ) struct key *key = (struct key *)obj; assert( obj->ops == &key_ops ); - if (key->name) free( key->name ); - if (key->class) free( key->class ); + free( key->name ); + free( key->class ); for (i = 0; i <= key->last_value; i++) { if (key->values[i].name) free( key->values[i].name ); if (key->values[i].data) free( key->values[i].data ); } - if (key->values) free( key->values ); + free( key->values ); for (i = 0; i <= key->last_subkey; i++) { key->subkeys[i]->parent = NULL; release_object( key->subkeys[i] ); } - if (key->subkeys) free( key->subkeys ); + free( key->subkeys ); /* unconditionally notify everything waiting on this key */ while ((ptr = list_head( &key->notify_list ))) { @@ -656,7 +656,7 @@ static struct key *create_key( struct key *key, const struct unicode_str *name, if (class && class->len) { key->classlen = class->len; - if (key->class) free(key->class); + free(key->class); if (!(key->class = memdup( class->str, key->classlen ))) key->classlen = 0; } grab_object( key ); @@ -887,11 +887,11 @@ static void set_value( struct key *key, const struct unicode_str *name, { if (!(value = insert_value( key, name, index ))) { - if (ptr) free( ptr ); + free( ptr ); return; } } - else if (value->data) free( value->data ); /* already existing, free previous data */ + else free( value->data ); /* already existing, free previous data */ value->type = type; value->len = len; @@ -983,8 +983,8 @@ static void delete_value( struct key *key, const struct unicode_str *name ) return; } if (debug_level > 1) dump_operation( key, value, "Delete" ); - if (value->name) free( value->name ); - if (value->data) free( value->data ); + free( value->name ); + free( value->data ); for (i = index; i < key->last_value; i++) key->values[i] = key->values[i + 1]; key->last_value--; touch_key( key, REG_NOTIFY_CHANGE_LAST_SET ); @@ -1310,7 +1310,7 @@ static int load_value( struct key *key, const char *buffer, struct file_load_inf if (!len) newptr = NULL; else if (!(newptr = memdup( ptr, len ))) return 0; - if (value->data) free( value->data ); + free( value->data ); value->data = newptr; value->len = len; value->type = type; diff --git a/server/request.c b/server/request.c index b0cebd5787d..07cc5fbd8fb 100644 --- a/server/request.c +++ b/server/request.c @@ -251,11 +251,8 @@ static void send_reply( union generic_reply *reply ) return; } } - if (current->reply_data) - { - free( current->reply_data ); - current->reply_data = NULL; - } + free( current->reply_data ); + current->reply_data = NULL; return; error: diff --git a/server/thread.c b/server/thread.c index 6644e594b65..05cf3cdf95f 100644 --- a/server/thread.c +++ b/server/thread.c @@ -213,12 +213,12 @@ static void cleanup_thread( struct thread *thread ) struct thread_apc *apc; while ((apc = thread_dequeue_apc( thread, 0 ))) free( apc ); - if (thread->req_data) free( thread->req_data ); - if (thread->reply_data) free( thread->reply_data ); + free( thread->req_data ); + free( thread->reply_data ); if (thread->request_fd) release_object( thread->request_fd ); if (thread->reply_fd) release_object( thread->reply_fd ); if (thread->wait_fd) release_object( thread->wait_fd ); - if (thread->suspend_context) free( thread->suspend_context ); + free( thread->suspend_context ); free_msg_queue( thread ); cleanup_clipboard_thread(thread); destroy_thread_windows( thread ); diff --git a/server/token.c b/server/token.c index ce08e95ac9e..44e1a90def7 100644 --- a/server/token.c +++ b/server/token.c @@ -594,12 +594,9 @@ struct token *token_create_admin( void ) default_dacl, admin_source ); } - if (alias_admins_sid) - free( alias_admins_sid ); - if (alias_users_sid) - free( alias_users_sid ); - if (default_dacl) - free( default_dacl ); + free( alias_admins_sid ); + free( alias_users_sid ); + free( default_dacl ); return token; } diff --git a/server/window.c b/server/window.c index ac97de55d3e..ea6dc3b7021 100644 --- a/server/window.c +++ b/server/window.c @@ -347,7 +347,7 @@ void destroy_window( struct window *win ) if (win->win_region) free_region( win->win_region ); if (win->update_region) free_region( win->update_region ); if (win->class) release_class( win->class ); - if (win->text) free( win->text ); + free( win->text ); memset( win, 0x55, sizeof(*win) + win->nb_extra_bytes - 1 ); free( win ); } @@ -1753,7 +1753,7 @@ DECL_HANDLER(set_window_text) memcpy( text, get_req_data(), len * sizeof(WCHAR) ); text[len] = 0; } - if (win->text) free( win->text ); + free( win->text ); win->text = text; } }