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

This commit is contained in:
Inada Naoki 2022-02-25 14:13:14 +09:00 committed by GitHub
parent 7d03c8be5a
commit ad6c7003e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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);