[lxc-devel] [lxc/master] coverity: #1437017
2xsec on Github
lxc-bot at linuxcontainers.org
Thu Jun 14 13:58:36 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 445 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180614/8697f530/attachment.bin>
-------------- next part --------------
From a5452e50b2106d86ffbe0094680fea6ce1db23e4 Mon Sep 17 00:00:00 2001
From: 2xsec <dh48.jeong at samsung.com>
Date: Thu, 14 Jun 2018 22:55:47 +0900
Subject: [PATCH] coverity: #1437017
Uninitialized pointer
Signed-off-by: 2xsec <dh48.jeong at samsung.com>
---
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) {
More information about the lxc-devel
mailing list