]> git.proxmox.com Git - mirror_lxc.git/commitdiff
coverity: #1437017
author2xsec <dh48.jeong@samsung.com>
Thu, 14 Jun 2018 13:55:47 +0000 (22:55 +0900)
committer2xsec <dh48.jeong@samsung.com>
Thu, 14 Jun 2018 13:55:47 +0000 (22:55 +0900)
Uninitialized pointer

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

index a4a5b857e4fdf27e9df59bbbc2d5698b3ab99550..8ec6045b9fba39fe45ac437ef64a882fd0536922 100644 (file)
@@ -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) {