[Python-checkins] bpo-46606: Remove redundant +1. (GH-31561)

methane webhook-mailer at python.org
Fri Feb 25 00:13:48 EST 2022


https://github.com/python/cpython/commit/ad6c7003e38a9f8bdf8d865fb5fa0f3c03690315
commit: ad6c7003e38a9f8bdf8d865fb5fa0f3c03690315
branch: main
author: Inada Naoki <songofacandy at gmail.com>
committer: methane <songofacandy at gmail.com>
date: 2022-02-25T14:13:14+09:00
summary:

bpo-46606: Remove redundant +1. (GH-31561)

files:
M Modules/posixmodule.c

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 5e942c43dd6c7..d3cfc828184e5 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -8186,7 +8186,7 @@ os_setgroups(PyObject *module, PyObject *groups)
         return NULL;
     }
 
-    gid_t *grouplist = PyMem_New(gid_t, len+1); // Avoid malloc(0)
+    gid_t *grouplist = PyMem_New(gid_t, len);
     for (Py_ssize_t i = 0; i < len; i++) {
         PyObject *elem;
         elem = PySequence_GetItem(groups, i);



More information about the Python-checkins mailing list