diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-07 14:21:41 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-07 14:21:41 (GMT) |
commit | b64049183cee61edc112eefa3ca76916d03e9f02 (patch) | |
tree | fd0be14ac288739314a5108c6e21879f641b0b40 /Modules/audioop.c | |
parent | 1a7425f67a0d141483d89ca80ca01e3cb7f6be92 (diff) | |
download | cpython-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/audioop.c')
-rw-r--r-- | Modules/audioop.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c index 4f2b25f..7175cec 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -1137,8 +1137,8 @@ audioop_ratecv(PyObject *self, PyObject *args) "not enough memory for output buffer"); return 0; } - prev_i = (int *) malloc(nchannels * sizeof(int)); - cur_i = (int *) malloc(nchannels * sizeof(int)); + prev_i = (int *) PyMem_Malloc(nchannels * sizeof(int)); + cur_i = (int *) PyMem_Malloc(nchannels * sizeof(int)); if (prev_i == NULL || cur_i == NULL) { (void) PyErr_NoMemory(); goto exit; @@ -1257,10 +1257,8 @@ audioop_ratecv(PyObject *self, PyObject *args) } } exit: - if (prev_i != NULL) - free(prev_i); - if (cur_i != NULL) - free(cur_i); + PyMem_Free(prev_i); + PyMem_Free(cur_i); return rv; } |