diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 01:49:12 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 01:49:12 (GMT) |
commit | 6bf1a8fe8be5d9e5458657befc811e8461e769f5 (patch) | |
tree | d7e0748ca62e2a2609510a98d55d04bde953c193 | |
parent | edb216807948670f716f920d3f7c6c0df3422381 (diff) | |
download | cpython-6bf1a8fe8be5d9e5458657befc811e8461e769f5.zip cpython-6bf1a8fe8be5d9e5458657befc811e8461e769f5.tar.gz cpython-6bf1a8fe8be5d9e5458657befc811e8461e769f5.tar.bz2 |
Handle NULL nodes while parsing. I'm not entirely sure this is correct.
There might be something else that needs to be done to setup the error.
Klocwork #295.
-rw-r--r-- | Parser/parsetok.c | 6 |
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; |