mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Hurd: fix sendmsg memory leak in error paths
This commit is contained in:
committed by
Roland McGrath
parent
5dbc3b6cc0
commit
23d101d8ee
@@ -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;
|
||||
|
Reference in New Issue
Block a user