From 04bed15ae752993b66e10876382bd8568353a582 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/lxc_user_nic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c index 3b9a3eb54..d79b02976 100644 --- a/src/lxc/lxc_user_nic.c +++ b/src/lxc/lxc_user_nic.c @@ -191,6 +191,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; @@ -205,8 +207,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