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
commit443c6ee6486ba4ab6f31b98065ee92d6892e5a34 (patch)
treee63046bbdbf6fe0534236cf615d53e3014fa007c /navit/command.c
parent69203eb850dffc989a18df3672d0511e8ae649f6 (diff)
downloadnavit-svn-443c6ee6486ba4ab6f31b98065ee92d6892e5a34.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 6aed4059..db23b950 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;