user-util: fix use after free() on error path

Fixes CID#1412356.
This commit is contained in:
Yu Watanabe
2020-01-31 23:23:44 +09:00
parent b44b735a78
commit 4af8ab2cab
+1 -3
View File
@@ -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);