summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-29 02:50:21 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-29 02:50:21 (GMT)
commit68f6adca6dbcf25c5cb3c2c411eaf0f9f6f1e793 (patch)
treedd9445a9dfd0d93f318c0d30f7517649d969ba95 /Modules
parentcc64eb5b9feaf610e75565600f6c6331e8fbe8d4 (diff)
downloadcpython-68f6adca6dbcf25c5cb3c2c411eaf0f9f6f1e793.zip
cpython-68f6adca6dbcf25c5cb3c2c411eaf0f9f6f1e793.tar.gz
cpython-68f6adca6dbcf25c5cb3c2c411eaf0f9f6f1e793.tar.bz2
Issue #18408: Fix _ctypes_alloc_format_string(), raise MemoryError on memory
allocation failure
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 37da94b..daba2ba 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -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