[Python-checkins] r51222 - python/trunk/Parser/parsetok.c

neal.norwitz python-checkins at python.org
Sat Aug 12 03:49:13 CEST 2006


Author: neal.norwitz
Date: Sat Aug 12 03:49:12 2006
New Revision: 51222

Modified:
   python/trunk/Parser/parsetok.c
Log:
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.


Modified: python/trunk/Parser/parsetok.c
==============================================================================
--- python/trunk/Parser/parsetok.c	(original)
+++ python/trunk/Parser/parsetok.c	Sat Aug 12 03:49:12 2006
@@ -229,6 +229,11 @@
 		}
 	} 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 @@
 		n = r;
 	}
 
+done:
 	PyTokenizer_Free(tok);
 
 	return n;


More information about the Python-checkins mailing list