mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
hurd: Only deallocate addrport when it's valid
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230423160548.126576-3-bugaevc@gmail.com>
This commit is contained in:
parent
70b9173caa
commit
4c39333050
5 changed files with 10 additions and 6 deletions
sysdeps/mach/hurd
|
@ -54,7 +54,8 @@ __recv (int fd, void *buf, size_t n, int flags)
|
||||||
if (err)
|
if (err)
|
||||||
return __hurd_sockfail (fd, flags, err);
|
return __hurd_sockfail (fd, flags, err);
|
||||||
|
|
||||||
__mach_port_deallocate (__mach_task_self (), addrport);
|
if (MACH_PORT_VALID (addrport))
|
||||||
|
__mach_port_deallocate (__mach_task_self (), addrport);
|
||||||
__vm_deallocate (__mach_task_self (), (vm_address_t) cdata, clen);
|
__vm_deallocate (__mach_task_self (), (vm_address_t) cdata, clen);
|
||||||
|
|
||||||
if (bufp != buf)
|
if (bufp != buf)
|
||||||
|
|
|
@ -94,7 +94,8 @@ __recvfrom (int fd, void *buf, size_t n, int flags, __SOCKADDR_ARG addrarg,
|
||||||
else if (addr_len != NULL)
|
else if (addr_len != NULL)
|
||||||
*addr_len = 0;
|
*addr_len = 0;
|
||||||
|
|
||||||
__mach_port_deallocate (__mach_task_self (), addrport);
|
if (MACH_PORT_VALID (addrport))
|
||||||
|
__mach_port_deallocate (__mach_task_self (), addrport);
|
||||||
|
|
||||||
/* Toss control data; we don't care. */
|
/* Toss control data; we don't care. */
|
||||||
__vm_deallocate (__mach_task_self (), (vm_address_t) cdata, clen);
|
__vm_deallocate (__mach_task_self (), (vm_address_t) cdata, clen);
|
||||||
|
|
|
@ -135,7 +135,8 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags)
|
||||||
else if (message->msg_name != NULL)
|
else if (message->msg_name != NULL)
|
||||||
message->msg_namelen = 0;
|
message->msg_namelen = 0;
|
||||||
|
|
||||||
__mach_port_deallocate (__mach_task_self (), aport);
|
if (MACH_PORT_VALID (aport))
|
||||||
|
__mach_port_deallocate (__mach_task_self (), aport);
|
||||||
|
|
||||||
if (buf == data)
|
if (buf == data)
|
||||||
buf += len;
|
buf += len;
|
||||||
|
|
|
@ -195,8 +195,9 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags)
|
||||||
message->msg_controllen,
|
message->msg_controllen,
|
||||||
&amount);
|
&amount);
|
||||||
LIBC_CANCEL_RESET (cancel_oldtype);
|
LIBC_CANCEL_RESET (cancel_oldtype);
|
||||||
__mach_port_deallocate (__mach_task_self (),
|
if (MACH_PORT_VALID (aport))
|
||||||
aport);
|
__mach_port_deallocate (__mach_task_self (),
|
||||||
|
aport);
|
||||||
}
|
}
|
||||||
err;
|
err;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -94,7 +94,7 @@ __sendto (int fd,
|
||||||
err;
|
err;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (aport != MACH_PORT_NULL)
|
if (MACH_PORT_VALID (aport))
|
||||||
__mach_port_deallocate (__mach_task_self (), aport);
|
__mach_port_deallocate (__mach_task_self (), aport);
|
||||||
|
|
||||||
return err ? __hurd_sockfail (fd, flags, err) : wrote;
|
return err ? __hurd_sockfail (fd, flags, err) : wrote;
|
||||||
|
|
Loading…
Add table
Reference in a new issue