summaryrefslogtreecommitdiff
path: root/navit/command.c
diff options
context:
space:
mode:
authormdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-11-10 21:56:18 +0000
committermdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-11-10 21:56:18 +0000
commite1bc312673df544861daa2ab6d24d58849ad71ff (patch)
treee63046bbdbf6fe0534236cf615d53e3014fa007c /navit/command.c
parent1b5041ca1213307363b4c4e8b300c8e1fdb5c670 (diff)
downloadnavit-e1bc312673df544861daa2ab6d24d58849ad71ff.tar.gz
Fix:core:Few more memleaks & one uninitialized variable reference|thank you valgrind for pointing these out
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5266 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/command.c')
-rw-r--r--navit/command.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/navit/command.c b/navit/command.c
index 6aed4059b..db23b950e 100644
--- a/navit/command.c
+++ b/navit/command.c
@@ -269,6 +269,7 @@ static void
set_double(struct context *ctx, struct result *res, double val)
{
result_free(res);
+ res->attr.type=attr_type_double_begin;
res->val=val;
}
@@ -444,6 +445,7 @@ command_call_function(struct context *ctx, struct result *res)
} else
res->attr.type=attr_none;
}
+ attr_list_free(list);
res->var=NULL;
res->varlen=0;
res->attrn=NULL;
@@ -606,16 +608,24 @@ eval_equality(struct context *ctx, struct result *res)
case '=':
if (res->attr.type == attr_none || tmp.attr.type == attr_none) {
set_int(ctx, res, 0);
- } else if (ATTR_IS_STRING(res->attr.type) && ATTR_IS_STRING(tmp.attr.type))
- set_int(ctx, res, (!strcmp(get_string(ctx, res),get_string(ctx, &tmp))));
+ } else if (ATTR_IS_STRING(res->attr.type) && ATTR_IS_STRING(tmp.attr.type)) {
+ char *s1=get_string(ctx, res),*s2=get_string(ctx, &tmp);
+ set_int(ctx, res, (!strcmp(s1,s2)));
+ g_free(s1);
+ g_free(s2);
+ }
else
set_int(ctx, res, (get_int(ctx, res) == get_int(ctx, &tmp)));
break;
case '!':
if (res->attr.type == attr_none || tmp.attr.type == attr_none) {
set_int(ctx, res, 1);
- } else if (ATTR_IS_STRING(res->attr.type) && ATTR_IS_STRING(tmp.attr.type))
- set_int(ctx, res, (!!strcmp(get_string(ctx, res),get_string(ctx, &tmp))));
+ } else if (ATTR_IS_STRING(res->attr.type) && ATTR_IS_STRING(tmp.attr.type)) {
+ char *s1=get_string(ctx, res),*s2=get_string(ctx, &tmp);
+ set_int(ctx, res, (!!strcmp(s1,s2)));
+ g_free(s1);
+ g_free(s2);
+ }
else
set_int(ctx, res, (get_int(ctx, res) != get_int(ctx, &tmp)));
break;