Fixed #5747 (When socket() returns -1 on error, this shouldn't be marked...

... as a resource leak)