Fix resource leak

This commit is contained in:
Přemysl Eric Janouch 2015-02-14 08:37:41 +01:00
parent 71aca1ad15
commit 8de88140f5
1 changed files with 3 additions and 0 deletions

View File

@ -720,9 +720,12 @@ unit_make (struct target *target, uint32_t ip, uint16_t port,
else if (errno == EINPROGRESS) else if (errno == EINPROGRESS)
connected = false; connected = false;
else else
{
xclose (socket_fd);
return errno == EADDRNOTAVAIL return errno == EADDRNOTAVAIL
? UNIT_MAKE_TRY_AGAIN ? UNIT_MAKE_TRY_AGAIN
: UNIT_MAKE_ERROR; : UNIT_MAKE_ERROR;
}
struct unit *u; struct unit *u;
if (!(u = unit_new (target, socket_fd, port, service, transport))) if (!(u = unit_new (target, socket_fd, port, service, transport)))