From c472b9a733e06f044a6bc7a502a9604c333b6fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 24 Apr 2024 23:38:23 +0200 Subject: php: remove check of NULL pointers before calling free() (issue #865) --- src/plugins/php/weechat-php-api.c | 6 ++---- src/plugins/php/weechat-php.c | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'src/plugins/php') diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c index 3624ba7ea..72dcfe948 100644 --- a/src/plugins/php/weechat-php-api.c +++ b/src/plugins/php/weechat-php-api.c @@ -214,8 +214,7 @@ weechat_php_cb (const void *pointer, void *data, void **func_argv, if (ret_type == WEECHAT_SCRIPT_EXEC_IGNORE) { - if (ret) - free (ret); + free (ret); } else if (ret_type == WEECHAT_SCRIPT_EXEC_INT) { @@ -235,8 +234,7 @@ weechat_php_cb (const void *pointer, void *data, void **func_argv, weechat_php_cb_err: if (ret_type == WEECHAT_SCRIPT_EXEC_IGNORE) { - if (ret) - free (ret); + free (ret); } else if (ret_type == WEECHAT_SCRIPT_EXEC_INT) { diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c index 4c5dafd82..633f243c1 100644 --- a/src/plugins/php/weechat-php.c +++ b/src/plugins/php/weechat-php.c @@ -747,8 +747,7 @@ weechat_php_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); @@ -761,8 +760,7 @@ weechat_php_unload (struct t_plugin_script *script) (void) weechat_hook_signal_send ("php_script_unloaded", WEECHAT_HOOK_SIGNAL_STRING, filename); - if (filename) - free (filename); + free (filename); } /* @@ -948,8 +946,7 @@ weechat_php_command_cb (const void *pointer, void *data, ptr_name, 1); weechat_php_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) { -- cgit v1.2.3