summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Parser/parsetok.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index 5fcaf1b..be53e1c 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -229,6 +229,11 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
}
} else if (tok->encoding != NULL) {
node* r = PyNode_New(encoding_decl);
+ if (!r) {
+ err_ret->error = E_NOMEM;
+ n = NULL;
+ goto done;
+ }
r->n_str = tok->encoding;
r->n_nchildren = 1;
r->n_child = n;
@@ -236,6 +241,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
n = r;
}
+done:
PyTokenizer_Free(tok);
return n;