(original) (raw)

changeset: 86723:1386fb31c0ed user: Victor Stinner victor.stinner@gmail.com date: Tue Oct 29 03:50:45 2013 +0100 files: Modules/_ctypes/stgdict.c description: Issue #18408: Fix PyCStructUnionType_update_stgdict(), handle _ctypes_alloc_format_string() failure diff -r 20cd15a28ad3 -r 1386fb31c0ed Modules/_ctypes/stgdict.c --- a/Modules/_ctypes/stgdict.c Tue Oct 29 03:50:21 2013 +0100 +++ b/Modules/_ctypes/stgdict.c Tue Oct 29 03:50:45 2013 +0100 @@ -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) /victor.stinner@gmail.com