Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
udp: do not leak file descriptor on error
Additional fixup for 3ed1214 in udp_bind()

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
  • Loading branch information
swegener authored and perexg committed Nov 9, 2015
1 parent f05c850 commit b00117e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/udp.c
Expand Up @@ -184,6 +184,8 @@ udp_bind ( const char *subsystem, const char *name,
return UDP_FATAL_ERROR;
}

uc->fd = fd;

/* Mark reuse address */
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse))) {
tvherror(subsystem, "%s - failed to reuse address for socket [%s]",
Expand Down Expand Up @@ -287,7 +289,6 @@ udp_bind ( const char *subsystem, const char *name,
tvhwarn(subsystem, "%s - cannot change UDP tx buffer size [%s]",
name, strerror(errno));

uc->fd = fd;
return uc;

error:
Expand Down

0 comments on commit b00117e

Please sign in to comment.