char *expr_dup;
int idx, mtype;
enum arg_type type1, type2;
+ long lng_a, lng_b;
+ double dbl_a, dbl_b;
idx = find_match_op(expr);
mtype = get_match_type(expr);
type2 = get_arg_type(expr_dup + idx + 1);
if (type1 == ARG_BAD || type2 == ARG_BAD) {
NORM_ERR("Bad arguments: '%s' and '%s'", expr_dup, (expr_dup + idx + 1));
+ free(expr_dup);
return -2;
}
if (type1 == ARG_LONG && type2 == ARG_DOUBLE)
if (type1 != type2) {
NORM_ERR("trying to compare args '%s' and '%s' of different type",
expr_dup, (expr_dup + idx + 1));
+ free(expr_dup);
return -2;
}
switch (type1) {
idx = scompare(a, mtype, b);
free(a);
free(b);
+ free(expr_dup);
return idx;
}
case ARG_LONG:
- return lcompare(arg_to_long(expr_dup), mtype,
- arg_to_long(expr_dup + idx + 1));
+ lng_a = arg_to_long(expr_dup);
+ lng_b = arg_to_long(expr_dup + idx + 1);
+ free(expr_dup);
+ return lcompare(lng_a, mtype, lng_b);
case ARG_DOUBLE:
- return dcompare(arg_to_double(expr_dup), mtype,
- arg_to_double(expr_dup + idx + 1));
+ dbl_a = arg_to_double(expr_dup);
+ dbl_b = arg_to_double(expr_dup + idx + 1);
+ free(expr_dup);
+ return lcompare(dbl_a, mtype, dbl_b);
case ARG_BAD: /* make_gcc_happy() */;
}
/* not reached */
+ free(expr_dup);
return -2;
}