/* Make sure that honor queue limit option is unset on the thread. */
th->options &= (~TH_OPT_HONOR_QLIMIT);
- if (kr == MACH_SEND_TIMED_OUT) {
- kr = KERN_SUCCESS;
+ if (kr != KERN_SUCCESS) {
+ ipc_port_release_send(user_port);
+
+ if (kr == MACH_SEND_TIMED_OUT) {
+ kr = KERN_SUCCESS;
+ }
}
+
return kr;
}
/* Make sure that honor queue limit option is unset on the thread. */
th->options &= (~TH_OPT_HONOR_QLIMIT);
- if (kr == MACH_SEND_TIMED_OUT) {
- kr = KERN_SUCCESS;
+ if (kr != KERN_SUCCESS) {
+ ipc_port_release_send(user_port);
+
+ if (kr == MACH_SEND_TIMED_OUT) {
+ kr = KERN_SUCCESS;
+ }
}
ipc_port_release_send(memory_port);