summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-06-26 17:51:32 -0700
committerOri Bernstein <ori@eigenstate.org>2015-06-26 17:51:32 -0700
commitfa8e0920764f9f298d6b6ac9471c862aec024e01 (patch)
tree1de50b002db5b01ae6a6379d51d0599da4de4e73 /mi
parentc1d212afb2854639aae86b9a44650f0769d0b90c (diff)
downloadmc-fa8e0920764f9f298d6b6ac9471c862aec024e01.tar.gz
Fix a few misc memory bugs.
Diffstat (limited to 'mi')
-rw-r--r--mi/match.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mi/match.c b/mi/match.c
index 0ba3f2c..343b383 100644
--- a/mi/match.c
+++ b/mi/match.c
@@ -189,9 +189,10 @@ static Dtree *addstruct(Dtree *t, Node *pat, Node *val, Node ***cap, size_t *nca
for (i = 0; i < pat->expr.nargs; i++) {
elt = pat->expr.args[i];
for (j = 0; j < t->nval; j++) {
- if (!strcmp(namestr(elt->expr.idx), namestr(t->val[j]->expr.idx)))
+ if (!strcmp(namestr(elt->expr.idx), namestr(t->val[j]->expr.idx))) {
t = addpat(t, pat->expr.args[i], NULL, cap, ncap);
- break;
+ break;
+ }
}
}
return t;
@@ -357,9 +358,13 @@ void dtdumpnode(Dtree *dt, FILE *f, int depth, int iswild)
{
Node *e;
size_t i;
+ char *s;
+
if (dt->patexpr) {
e = dt->patexpr;
- indentf(depth, "%s%s %s : %s\n", iswild ? "WILDCARD " : "", opstr[exprop(e)], dtnodestr(e), tystr(exprtype(e)));
+ s = tystr(exprtype(e));
+ indentf(depth, "%s%s %s : %s\n", iswild ? "WILDCARD " : "", opstr[exprop(e)], dtnodestr(e), s);
+ free(s);
}
if (dt->cap)
for (i = 0; i < dt->ncap; i++)