summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/python/pysss.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/python/pysss.c b/src/python/pysss.c
index 668d77c56..8f98f081c 100644
--- a/src/python/pysss.c
+++ b/src/python/pysss.c
@@ -771,7 +771,11 @@ static PyObject *py_sss_getgrouplist(PyObject *self, PyObject *args)
do {
ret = getgrouplist(username, pw->pw_gid, groups, &ngroups);
if (ret < ngroups) {
- groups = realloc(groups, ngroups * sizeof(gid_t));
+ gid_t *tmp_groups = realloc(groups, ngroups * sizeof(gid_t));
+ if (tmp_groups == NULL) {
+ goto fail;
+ }
+ groups = tmp_groups;
}
} while (ret != ngroups);