summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-01-07 08:24:40 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-01-07 08:24:40 +0100
commitcd37f120597acfbbedb2414d0cb8bf7c8407bffc (patch)
tree56faba655501c310f688d884941cb0537f6208e6 /src/core
parentbd21daebd18b1a33262fec56ac16aec52f70f285 (diff)
downloadweechat-cd37f120597acfbbedb2414d0cb8bf7c8407bffc.zip
core: fix memory leak in evaluation of expression when a logical operator ("&&" or "||") is found
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index a55daaff4..39203d5ed 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -569,6 +569,8 @@ eval_expression_internal (const char *expr, struct t_hashtable *pointers,
tmp_value = eval_expression_internal (sub_expr, pointers, extra_vars, 0);
free (sub_expr);
rc = eval_is_true (tmp_value);
+ if (tmp_value)
+ free (tmp_value);
/*
* if rc == 0 with "&&" or rc == 1 with "||", no need to evaluate
* second sub-expression, just return the rc
@@ -576,8 +578,6 @@ eval_expression_internal (const char *expr, struct t_hashtable *pointers,
if ((!rc && (logic == EVAL_LOGICAL_OP_AND))
|| (rc && (logic == EVAL_LOGICAL_OP_OR)))
{
- if (tmp_value)
- free (tmp_value);
value = strdup ((rc) ? EVAL_STR_TRUE : EVAL_STR_FALSE);
goto end;
}