From 4b57c95494b5a4cbcc52a4e841c1a0724ed21725 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 2 Mar 2014 17:43:19 +0100 Subject: [PATCH] core: fix memory leak in evaluation of sub-conditions --- ChangeLog | 1 + src/core/wee-eval.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 865d39fe8..daf12c7fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 0.4.4 (under dev) +* core: fix memory leak in evaluation of sub-conditions * core: fix memory leak in function gui_key_add_to_infolist (in case of insufficient memory) * core: fix use of invalid pointer in function gui_bar_window_content_alloc diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c index 88596cec8..01243c198 100644 --- a/src/core/wee-eval.c +++ b/src/core/wee-eval.c @@ -603,7 +603,11 @@ eval_expression_condition (const char *expr, struct t_hashtable *pointers, + 1; tmp_value2 = malloc (length); if (!tmp_value2) + { + if (tmp_value) + free (tmp_value); goto end; + } tmp_value2[0] = '\0'; if (pos > expr2) { @@ -619,6 +623,8 @@ eval_expression_condition (const char *expr, struct t_hashtable *pointers, } free (expr2); expr2 = tmp_value2; + if (tmp_value) + free (tmp_value); } }