]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Handle NULL nodes while parsing. I'm not entirely sure this is correct.
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 12 Aug 2006 01:49:12 +0000 (01:49 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 12 Aug 2006 01:49:12 +0000 (01:49 +0000)
There might be something else that needs to be done to setup the error.

Klocwork #295.

Parser/parsetok.c

index 5fcaf1b36a72eb5f22dea11a7a0cf3c23756fe60..be53e1c5912f2e19bd9fbd81e4e840372dc30123 100644 (file)
@@ -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;