1
0
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:
Yu Watanabe 2020-01-31 23:23:44 +09:00
parent b44b735a78
commit 4af8ab2cab

View File

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