Cygwin: fix memory corruption/SEGV if certain socket functions fail
Regression introduced with 2.11.0: The failure paths in socket, socketpair and accept4 functions and methods accidentally release *unused* cygheap_fdmanip objects. The subsequently called dtable::release method was designed to be called for *used* cygheap_fdmanip objects only. Using them on unused objects leads to NULL pointer member dereferencing. Worse, the inet/local accept4 methods only release the cygheap_fdmanip object but neglect to delete the just created fhandler_socket_* object. Fix this by removing the erroneous release calls in the aforementioned failure paths and delete the fhandler_socket_* object in accept4 instead. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@ -1639,7 +1639,6 @@ fhandler_socket_unix::accept4 (struct sockaddr *peer, int *len, int flags)
|
||||
create_shmem_failed:
|
||||
delete sock;
|
||||
}
|
||||
fd.release ();
|
||||
}
|
||||
}
|
||||
/* Ouch! We can't handle the client if we couldn't
|
||||
|
Reference in New Issue
Block a user