user-util: fix use after free() on error path
Fixes CID#1412356.
This commit is contained in:
@@ -496,11 +496,9 @@ int getgroups_alloc(gid_t** gids) {
|
||||
|
||||
free(allocated);
|
||||
|
||||
allocated = new(gid_t, ngroups);
|
||||
p = allocated = new(gid_t, ngroups);
|
||||
if (!allocated)
|
||||
return -ENOMEM;
|
||||
|
||||
p = allocated;
|
||||
}
|
||||
|
||||
*gids = TAKE_PTR(p);
|
||||
|
||||
Reference in New Issue
Block a user