Skip to content

Commit

Permalink
Hurd: fix sendmsg memory leak in error paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilio Pozuelo Monfort authored and Roland McGrath committed Jul 21, 2010
1 parent 5dbc3b6 commit 23d101d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
ld.so.cache was broken. With it, there is no way to disable dsocaps
like LD_HWCAP_MASK can disable hwcaps.

2010-06-02 Emilio Pozuelo Monfort <pochu27@gmail.com>

* sysdeps/mach/hurd/sendmsg.c (__libc_sendmsg): Fix memory leaks.

2010-07-16 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/multiarch/strstr.c: Rewrite to avoid indirect function
Expand Down
12 changes: 10 additions & 2 deletions sysdeps/mach/hurd/sendmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,22 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags)
and talk to it with the ifsock protocol. */
file_t file = __file_name_lookup (addr->sun_path, 0, 0);
if (file == MACH_PORT_NULL)
return -1;
{
if (dealloc)
__vm_deallocate (__mach_task_self (), data.addr, len);
return -1;
}
err = __ifsock_getsockaddr (file, &aport);
__mach_port_deallocate (__mach_task_self (), file);
if (err == MIG_BAD_ID || err == EOPNOTSUPP)
/* The file did not grok the ifsock protocol. */
err = ENOTSOCK;
if (err)
return __hurd_fail (err);
{
if (dealloc)
__vm_deallocate (__mach_task_self (), data.addr, len);
return __hurd_fail (err);
}
}
else
err = EIEIO;
Expand Down

0 comments on commit 23d101d

Please sign in to comment.