summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-24 23:35:11 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-25 20:59:24 +0200
commit3e994e3c5a5c15ad9e501ac1e7ae69d173eddefe (patch)
tree4eb6b6cd5bf8b7d00f0b09d57fb345e449577f87 /src/plugins
parent128d2a4e12bd9423f40f011060db0e9c5d8bc6bd (diff)
downloadweechat-3e994e3c5a5c15ad9e501ac1e7ae69d173eddefe.zip
lua: remove check of NULL pointers before calling free() (issue #865)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/weechat-lua-api.c11
-rw-r--r--src/plugins/lua/weechat-lua.c12
2 files changed, 7 insertions, 16 deletions
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index c13fdb38e..5f10bf34e 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -1333,9 +1333,7 @@ weechat_lua_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);
}
}
@@ -1360,9 +1358,7 @@ weechat_lua_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);
}
}
@@ -3102,8 +3098,7 @@ weechat_lua_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/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index 71992b417..6c17e7caf 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -749,8 +749,7 @@ weechat_lua_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);
@@ -770,8 +769,7 @@ weechat_lua_unload (struct t_plugin_script *script)
(void) weechat_hook_signal_send ("lua_script_unloaded",
WEECHAT_HOOK_SIGNAL_STRING, filename);
- if (filename)
- free (filename);
+ free (filename);
}
/*
@@ -887,8 +885,7 @@ weechat_lua_eval (struct t_gui_buffer *buffer, int send_to_buffer_as_input,
"script_lua_eval",
"s", func_argv);
/* result is ignored */
- if (result)
- free (result);
+ free (result);
weechat_lua_output_flush ();
@@ -994,8 +991,7 @@ weechat_lua_command_cb (const void *pointer, void *data,
ptr_name, 1);
weechat_lua_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)
{