From a5452e50b2106d86ffbe0094680fea6ce1db23e4 Mon Sep 17 00:00:00 2001 From: 2xsec Date: Thu, 14 Jun 2018 22:55:47 +0900 Subject: [PATCH] coverity: #1437017 Uninitialized pointer Signed-off-by: 2xsec --- src/lxc/cmd/lxc_user_nic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/cmd/lxc_user_nic.c b/src/lxc/cmd/lxc_user_nic.c index a4a5b857e..8ec6045b9 100644 --- a/src/lxc/cmd/lxc_user_nic.c +++ b/src/lxc/cmd/lxc_user_nic.c @@ -192,6 +192,8 @@ static char **get_groupnames(void) return NULL; } + memset(groupnames, 0, sizeof(char *) * (ngroups + 1)); + bufsize = sysconf(_SC_GETGR_R_SIZE_MAX); if (bufsize == -1) bufsize = 1024; @@ -206,8 +208,6 @@ static char **get_groupnames(void) return NULL; } - memset(groupnames, 0, sizeof(char *) * (ngroups + 1)); - for (i = 0; i < ngroups; i++) { ret = getgrgid_r(group_ids[i], &grent, buf, bufsize, &grentp); if (!grentp) { -- 2.47.2