mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 07:51:21 +03:00
user-util: fix use after free() on error path
Fixes CID#1412356.
This commit is contained in:
parent
b44b735a78
commit
4af8ab2cab
@ -496,11 +496,9 @@ int getgroups_alloc(gid_t** gids) {
|
|||||||
|
|
||||||
free(allocated);
|
free(allocated);
|
||||||
|
|
||||||
allocated = new(gid_t, ngroups);
|
p = allocated = new(gid_t, ngroups);
|
||||||
if (!allocated)
|
if (!allocated)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
p = allocated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*gids = TAKE_PTR(p);
|
*gids = TAKE_PTR(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user