diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 19:01:56 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-26 08:53:22 +0200 |
commit | 0b2d9bcb9b04b7e7ac3c2f626422392383575d2b (patch) | |
tree | 177e487efc30717415402ba969b246de3f88b28d /src/plugins/perl | |
parent | 1ad0b4b6699df50e0cc6a3c5d62ce3ac1f77440c (diff) | |
download | weechat-0b2d9bcb9b04b7e7ac3c2f626422392383575d2b.zip |
plugins: remove check of NULL pointers before calling weechat_hashtable_free() (issue #865)
Diffstat (limited to 'src/plugins/perl')
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 54 |
1 files changed, 18 insertions, 36 deletions
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 0531ec0de..0c547c28a 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -483,12 +483,9 @@ API_FUNC(string_eval_expression) result = weechat_string_eval_expression (expr, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -520,12 +517,9 @@ API_FUNC(string_eval_path_home) result = weechat_string_eval_path_home (path, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -2023,8 +2017,7 @@ API_FUNC(key_bind) num_keys = weechat_key_bind (context, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(num_keys); } @@ -2712,8 +2705,7 @@ API_FUNC(hook_process_hashtable) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -2787,8 +2779,7 @@ API_FUNC(hook_url) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -3215,8 +3206,7 @@ API_FUNC(hook_hsignal_send) rc = weechat_hook_hsignal_send (signal, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(rc); } @@ -3769,8 +3759,7 @@ API_FUNC(buffer_new_props) function_close, data_close)); - if (properties) - weechat_hashtable_free (properties); + weechat_hashtable_free (properties); API_RETURN_STRING(result); } @@ -4665,8 +4654,7 @@ API_FUNC(command_options) API_STR2PTR(buffer), command, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_INT(rc); } @@ -4799,10 +4787,8 @@ API_FUNC(info_get_hashtable) result_hashtable = weechat_info_get_hashtable (info_name, hashtable); result_hash = weechat_perl_hashtable_to_hash (result_hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); - if (result_hashtable) - weechat_hashtable_free (result_hashtable); + weechat_hashtable_free (hashtable); + weechat_hashtable_free (result_hashtable); API_RETURN_OBJ(result_hash); } @@ -5314,12 +5300,9 @@ API_FUNC(hdata_search) options, move)); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -5538,8 +5521,7 @@ API_FUNC(hdata_update) API_STR2PTR(pointer), hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(value); } |