summaryrefslogtreecommitdiff
path: root/src/plugins/plugin-script.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-08-09 18:49:06 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-08-09 18:49:06 +0200
commit4e43be6d2cfbf396e8fcfe36f09663da7140a03c (patch)
treeca26dccca5c71b54580bbb3fa0b3b8b873483042 /src/plugins/plugin-script.c
parentfc71ce0d43e2d060b3e049636e7453800f668865 (diff)
downloadweechat-4e43be6d2cfbf396e8fcfe36f09663da7140a03c.zip
core: fix memory leak when removing script files
Diffstat (limited to 'src/plugins/plugin-script.c')
-rw-r--r--src/plugins/plugin-script.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index 678ec1454..6842cf159 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -907,9 +907,16 @@ plugin_script_remove_file (struct t_weechat_plugin *weechat_plugin,
while (i < 2)
{
path_script = plugin_script_search_path (weechat_plugin, name);
- /* script not found? */
+ /*
+ * script not found? (if path_script == name, that means the function
+ * above did not find the script)
+ */
if (!path_script || (strcmp (path_script, name) == 0))
+ {
+ if (path_script)
+ free (path_script);
break;
+ }
num_found++;
if (unlink (path_script) == 0)
{