Commit a5452e50 by 2xsec

coverity: #1437017

Uninitialized pointer Signed-off-by: 's avatar2xsec <dh48.jeong@samsung.com>
parent aef295c2
...@@ -192,6 +192,8 @@ static char **get_groupnames(void) ...@@ -192,6 +192,8 @@ static char **get_groupnames(void)
return NULL; return NULL;
} }
memset(groupnames, 0, sizeof(char *) * (ngroups + 1));
bufsize = sysconf(_SC_GETGR_R_SIZE_MAX); bufsize = sysconf(_SC_GETGR_R_SIZE_MAX);
if (bufsize == -1) if (bufsize == -1)
bufsize = 1024; bufsize = 1024;
...@@ -206,8 +208,6 @@ static char **get_groupnames(void) ...@@ -206,8 +208,6 @@ static char **get_groupnames(void)
return NULL; return NULL;
} }
memset(groupnames, 0, sizeof(char *) * (ngroups + 1));
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
ret = getgrgid_r(group_ids[i], &grent, buf, bufsize, &grentp); ret = getgrgid_r(group_ids[i], &grent, buf, bufsize, &grentp);
if (!grentp) { if (!grentp) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment