[Python-checkins] cpython: Issue #18408: Fix PyCStructUnionType_update_stgdict(), handle

victor.stinner python-checkins at python.org
Tue Oct 29 03:51:26 CET 2013


http://hg.python.org/cpython/rev/1386fb31c0ed
changeset:   86723:1386fb31c0ed
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Oct 29 03:50:45 2013 +0100
summary:
  Issue #18408: Fix PyCStructUnionType_update_stgdict(), handle
_ctypes_alloc_format_string() failure

files:
  Modules/_ctypes/stgdict.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -417,6 +417,8 @@
            that). Use 'B' for bytes. */
         stgdict->format = _ctypes_alloc_format_string(NULL, "B");
     }
+    if (stgdict->format == NULL)
+        return -1;
 
 #define realdict ((PyObject *)&stgdict->dict)
     for (i = 0; i < len; ++i) {
@@ -483,7 +485,7 @@
             char *fieldfmt = dict->format ? dict->format : "B";
             char *fieldname = _PyUnicode_AsString(name);
             char *ptr;
-            Py_ssize_t len; 
+            Py_ssize_t len;
             char *buf;
 
             if (fieldname == NULL)

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


More information about the Python-checkins mailing list