summaryrefslogtreecommitdiffstats
path: root/Modules/zlibmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-07 14:21:41 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-07 14:21:41 (GMT)
commitb64049183cee61edc112eefa3ca76916d03e9f02 (patch)
treefd0be14ac288739314a5108c6e21879f641b0b40 /Modules/zlibmodule.c
parent1a7425f67a0d141483d89ca80ca01e3cb7f6be92 (diff)
downloadcpython-b64049183cee61edc112eefa3ca76916d03e9f02.zip
cpython-b64049183cee61edc112eefa3ca76916d03e9f02.tar.gz
cpython-b64049183cee61edc112eefa3ca76916d03e9f02.tar.bz2
Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules
Replace malloc() with PyMem_Malloc() when the GIL is held, or with PyMem_RawMalloc() otherwise.
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r--Modules/zlibmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 8100cbf..30147ae 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -165,7 +165,7 @@ PyZlib_compress(PyObject *self, PyObject *args)
zst.avail_out = length + length/1000 + 12 + 1;
- output = (Byte*)malloc(zst.avail_out);
+ output = (Byte*)PyMem_Malloc(zst.avail_out);
if (output == NULL) {
PyErr_SetString(PyExc_MemoryError,
"Can't allocate memory to compress data");
@@ -218,7 +218,7 @@ PyZlib_compress(PyObject *self, PyObject *args)
error:
PyBuffer_Release(&pinput);
- free(output);
+ PyMem_Free(output);
return ReturnVal;
}