[Python-checkins] cpython: Check return value of asdl_seq_new(). Found by Coverity.

stefan.krah python-checkins at python.org
Mon Aug 20 16:11:43 CEST 2012


http://hg.python.org/cpython/rev/663de4dbb88a
changeset:   78673:663de4dbb88a
user:        Stefan Krah <skrah at bytereef.org>
date:        Mon Aug 20 16:07:38 2012 +0200
summary:
  Check return value of asdl_seq_new(). Found by Coverity.

files:
  Python/ast.c |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Python/ast.c b/Python/ast.c
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -3502,6 +3502,8 @@
 
     n_items = (NCH(n) - 2) / 2;
     items = asdl_seq_new(n_items, c->c_arena);
+    if (!items)
+        return NULL;
     for (i = 1; i < NCH(n) - 2; i += 2) {
         withitem_ty item = ast_for_with_item(c, CHILD(n, i));
         if (!item)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list