Skip to content

Commit

Permalink
Merge pull request #2402 from 2xsec/coverity1
Browse files Browse the repository at this point in the history
coverity: #1437017
  • Loading branch information
brauner committed Jun 14, 2018
2 parents aef295c + a5452e5 commit 40f3bd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lxc/cmd/lxc_user_nic.c
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 40f3bd6

Please sign in to comment.