mirror of https://github.com/python/cpython
Issue #18408: Fix _ctypes_alloc_format_string(), raise MemoryError on memory
allocation failure
This commit is contained in:
parent
cc64eb5b9f
commit
68f6adca6d
|
@ -278,8 +278,10 @@ _ctypes_alloc_format_string(const char *prefix, const char *suffix)
|
|||
if (prefix)
|
||||
len += strlen(prefix);
|
||||
result = PyMem_Malloc(len + 1);
|
||||
if (result == NULL)
|
||||
if (result == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
if (prefix)
|
||||
strcpy(result, prefix);
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue