From: 2xsec Date: Thu, 14 Jun 2018 13:55:47 +0000 (+0900) Subject: coverity: #1437017 X-Git-Tag: lxc-2.0.10~97 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04bed15ae752993b66e10876382bd8568353a582;p=thirdparty%2Flxc.git coverity: #1437017 Uninitialized pointer Signed-off-by: 2xsec --- 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) {