From 4e43be6d2cfbf396e8fcfe36f09663da7140a03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 9 Aug 2014 18:49:06 +0200 Subject: [PATCH] core: fix memory leak when removing script files --- ChangeLog.asciidoc | 1 + src/plugins/plugin-script.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 4b44da612..0d1205fec 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -15,6 +15,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 1.0 (under dev) +* core: fix memory leak when removing script files * core: fix result of hash function (in hashtables) on 32-bit systems * core: add terabyte unit for size displayed * core: fix insert of mouse code in input line after a partial key combo 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) {