diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 19:05:34 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-26 08:53:22 +0200 |
commit | f11c7c1bf46d494a5a0df616ed0dcc11c64505e1 (patch) | |
tree | 072da21e69168e3f90605f4ba009e7f665189b35 /src/core | |
parent | 0b2d9bcb9b04b7e7ac3c2f626422392383575d2b (diff) | |
download | weechat-f11c7c1bf46d494a5a0df616ed0dcc11c64505e1.zip |
core: remove check of NULL pointers before calling hashtable_free() (issue #865)
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core-command.c | 6 | ||||
-rw-r--r-- | src/core/core-completion.c | 3 | ||||
-rw-r--r-- | src/core/core-eval.c | 3 | ||||
-rw-r--r-- | src/core/core-hdata.c | 6 | ||||
-rw-r--r-- | src/core/core-network.c | 3 | ||||
-rw-r--r-- | src/core/core-secure-buffer.c | 3 | ||||
-rw-r--r-- | src/core/hook/hook-line.c | 3 |
7 files changed, 9 insertions, 18 deletions
diff --git a/src/core/core-command.c b/src/core/core-command.c index 1bcbe1cb6..552040a2d 100644 --- a/src/core/core-command.c +++ b/src/core/core-command.c @@ -2485,10 +2485,8 @@ COMMAND_CALLBACK(eval) gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); } - if (pointers) - hashtable_free (pointers); - if (options) - hashtable_free (options); + hashtable_free (pointers); + hashtable_free (options); } return WEECHAT_RC_OK; diff --git a/src/core/core-completion.c b/src/core/core-completion.c index 1f00ecdee..21cb25e60 100644 --- a/src/core/core-completion.c +++ b/src/core/core-completion.c @@ -1317,8 +1317,7 @@ completion_list_add_plugins_installed_cb (const void *pointer, void *data, hashtable_set (options, "directory", "data"); plugin_path = string_eval_path_home (CONFIG_STRING(config_plugin_path), NULL, NULL, options); - if (options) - hashtable_free (options); + hashtable_free (options); if (plugin_path) { dir_exec_on_files (plugin_path, 1, 0, diff --git a/src/core/core-eval.c b/src/core/core-eval.c index 815273aaa..dff54a089 100644 --- a/src/core/core-eval.c +++ b/src/core/core-eval.c @@ -2778,8 +2778,7 @@ eval_expression (const char *expr, struct t_hashtable *pointers, if (ptr_buffer_added) hashtable_remove (pointers, "buffer"); } - if (user_vars) - hashtable_free (user_vars); + hashtable_free (user_vars); if (regex && regex_allocated) { regfree (regex); diff --git a/src/core/core-hdata.c b/src/core/core-hdata.c index a7ec9cada..cd4d28569 100644 --- a/src/core/core-hdata.c +++ b/src/core/core-hdata.c @@ -1404,12 +1404,10 @@ hdata_free (struct t_hdata *hdata) if (!hdata) return; - if (hdata->hash_var) - hashtable_free (hdata->hash_var); + hashtable_free (hdata->hash_var); free (hdata->var_prev); free (hdata->var_next); - if (hdata->hash_list) - hashtable_free (hdata->hash_list); + hashtable_free (hdata->hash_list); free (hdata->name); free (hdata); diff --git a/src/core/core-network.c b/src/core/core-network.c index fc34a6060..9b9def496 100644 --- a/src/core/core-network.c +++ b/src/core/core-network.c @@ -234,8 +234,7 @@ network_load_user_ca_files (int force_display) end: if (paths) string_free_split (paths); - if (options) - hashtable_free (options); + hashtable_free (options); network_num_certs_user = num_loaded; diff --git a/src/core/core-secure-buffer.c b/src/core/core-secure-buffer.c index 70661d2cf..be2deb343 100644 --- a/src/core/core-secure-buffer.c +++ b/src/core/core-secure-buffer.c @@ -244,8 +244,7 @@ secure_buffer_open () secure_buffer_display_values = 0; - if (properties) - hashtable_free (properties); + hashtable_free (properties); } if (!secure_buffer) diff --git a/src/core/hook/hook-line.c b/src/core/hook/hook-line.c index ed1fcb781..371e06d88 100644 --- a/src/core/hook/hook-line.c +++ b/src/core/hook/hook-line.c @@ -205,8 +205,7 @@ hook_line_exec (struct t_gui_line *line) hook_exec_end (); - if (hashtable) - hashtable_free (hashtable); + hashtable_free (hashtable); } /* |