diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-24 23:53:55 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 20:59:25 +0200 |
commit | 0e3b6a9c774c8f9587fd00acfb5716a520783d84 (patch) | |
tree | 1c6d15ab72f2b332da1509ee35dc4ac3224559bb | |
parent | 1f104d06a09b93ef18485bda53ff6e83ea99be1b (diff) | |
download | weechat-0e3b6a9c774c8f9587fd00acfb5716a520783d84.zip |
tcl: remove check of NULL pointers before calling free() (issue #865)
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 11 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl.c | 9 |
2 files changed, 6 insertions, 14 deletions
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index f6c26b276..d1c0ab14d 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -1330,9 +1330,7 @@ weechat_tcl_api_config_option_change_cb (const void *pointer, void *data, WEECHAT_SCRIPT_EXEC_IGNORE, ptr_function, "ss", func_argv); - - if (rc) - free (rc); + free (rc); } } @@ -1357,9 +1355,7 @@ weechat_tcl_api_config_option_delete_cb (const void *pointer, void *data, WEECHAT_SCRIPT_EXEC_IGNORE, ptr_function, "ss", func_argv); - - if (rc) - free (rc); + free (rc); } } @@ -3060,8 +3056,7 @@ weechat_tcl_api_hook_print_cb (const void *pointer, void *data, ret = *rc; free (rc); } - if (func_argv[3]) - free (func_argv[3]); + free (func_argv[3]); return ret; } diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c index eee51f58b..309ab33b6 100644 --- a/src/plugins/tcl/weechat-tcl.c +++ b/src/plugins/tcl/weechat-tcl.c @@ -448,8 +448,7 @@ weechat_tcl_unload (struct t_plugin_script *script) WEECHAT_SCRIPT_EXEC_INT, script->shutdown_func, NULL, NULL); - if (rc) - free (rc); + free (rc); } filename = strdup (script->filename); @@ -465,8 +464,7 @@ weechat_tcl_unload (struct t_plugin_script *script) (void) weechat_hook_signal_send ("tcl_script_unloaded", WEECHAT_HOOK_SIGNAL_STRING, filename); - if (filename) - free (filename); + free (filename); } /* @@ -652,8 +650,7 @@ weechat_tcl_command_cb (const void *pointer, void *data, ptr_name, 1); weechat_tcl_load ((path_script) ? path_script : ptr_name, NULL); - if (path_script) - free (path_script); + free (path_script); } else if (weechat_strcmp (argv[1], "reload") == 0) { |