]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1437017
author2xsec <dh48.jeong@samsung.com>
Thu, 14 Jun 2018 13:55:47 +0000 (22:55 +0900)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Dec 2018 08:16:07 +0000 (09:16 +0100)
Uninitialized pointer

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/lxc_user_nic.c

index 3b9a3eb5413c9e7a15d264940b2c368a7a17be94..d79b02976eb2efdd8e5f5b7d4a2b1fc8f01de40a 100644 (file)
@@ -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) {