From: Yu Watanabe Date: Fri, 31 Jan 2020 14:23:44 +0000 (+0900) Subject: user-util: fix use after free() on error path X-Git-Tag: v245-rc1~42^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4af8ab2cab69c6ed87ca5553bfe082506325a6d8;p=thirdparty%2Fsystemd.git user-util: fix use after free() on error path Fixes CID#1412356. --- diff --git a/src/basic/user-util.c b/src/basic/user-util.c index 68c6dd0da78..6d22fe31c3d 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -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);