Skip to content

Commit

Permalink
Don't use Raw malloc & free.
Browse files Browse the repository at this point in the history
Backport of d1732fe to 3.11 from python#104697.
  • Loading branch information
gpshead committed May 23, 2023
1 parent 0991dae commit c684290
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/_posixsubprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
#endif /* HAVE_SETREUID */
}

c_fds_to_keep = PyMem_RawMalloc(fds_to_keep_len * sizeof(int));
c_fds_to_keep = PyMem_Malloc(fds_to_keep_len * sizeof(int));
if (c_fds_to_keep == NULL) {
PyErr_SetString(PyExc_MemoryError, "failed to malloc c_fds_to_keep");
goto cleanup;
Expand Down Expand Up @@ -1109,7 +1109,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)

cleanup:
if (c_fds_to_keep != NULL) {
PyMem_RawFree(c_fds_to_keep);
PyMem_Free(c_fds_to_keep);
}

if (saved_errno != 0) {
Expand Down

0 comments on commit c684290

Please # to comment.