aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libparser.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libparser.c b/libparser.c
index 4a42c43..ce26273 100644
--- a/libparser.c
+++ b/libparser.c
@@ -53,18 +53,19 @@ try_match(const char *rule, const union libparser_sentence *sentence, struct con
size_t i;
if (!ctx->cache) {
- unit = calloc(1, sizeof(*unit));
+ unit = malloc(sizeof(*unit));
if (!unit) {
ctx->done = 1;
ctx->error = 1;
return NULL;
}
+ unit->end = 0;
} else {
unit = ctx->cache;
ctx->cache = unit->next;
- unit->in = unit->next = NULL;
}
+ unit->in = unit->next = NULL;
unit->rule = rule;
unit->start = ctx->position;