Skip to content

Commit

Permalink
Fix use of uninitialized variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schwab committed Mar 25, 2014
1 parent 449282f commit 6da3618
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-03-25 Andreas Schwab <schwab@suse.de>

* sysdeps/unix/sysv/linux/check_pf.c (make_request): Add out_fail2
label to be used after in6ailist is initialized.

2014-03-20 Adhemerval Zanella <azanella@linux.vnet.ibm.com>

* nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h
Expand Down
11 changes: 6 additions & 5 deletions sysdeps/unix/sysv/linux/check_pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ make_request (int fd, pid_t pid)

ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
if (read_len < 0)
goto out_fail;
goto out_fail2;

if (msg.msg_flags & MSG_TRUNC)
goto out_fail;
goto out_fail2;

struct nlmsghdr *nlmh;
for (nlmh = (struct nlmsghdr *) buf;
Expand Down Expand Up @@ -251,7 +251,7 @@ make_request (int fd, pid_t pid)
{
newp = malloc (sizeof (*newp));
if (newp == NULL)
goto out_fail;
goto out_fail2;
newp->use_malloc = true;
}
newp->info.flags = (((ifam->ifa_flags
Expand Down Expand Up @@ -289,7 +289,7 @@ make_request (int fd, pid_t pid)
result = malloc (sizeof (*result)
+ in6ailistlen * sizeof (struct in6addrinfo));
if (result == NULL)
goto out_fail;
goto out_fail2;

result->timestamp = get_nl_timestamp ();
result->usecnt = 2;
Expand Down Expand Up @@ -319,14 +319,15 @@ make_request (int fd, pid_t pid)
free (buf);
return result;

out_fail:
out_fail2:
while (in6ailist != NULL)
{
struct in6ailist *next = in6ailist->next;
if (in6ailist->use_malloc)
free (in6ailist);
in6ailist = next;
}
out_fail:
if (use_malloc)
free (buf);
return NULL;
Expand Down

0 comments on commit 6da3618

Please sign in to comment.