summaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorAnders Nystrom <anders.nystrom@southpole.se>2015-04-09 02:38:41 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-04-09 14:32:37 +0200
commit27852f2f1dec3749ea79883b70484c841169f747 (patch)
tree2d05918162c4a5d6ead0dac3fe64f6d4ff5c5088 /libavformat/tcp.c
parent0266988ccd15436eaf5f7bb6f9509e6bfd5ce589 (diff)
libavformat: Handle error return from ff_listen_bind
Handle error return from ff_listen_bind without leaking file descriptors. Signed-off-by: Anders Nystrom <anders.nystrom@southpole.se> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 9585dc08d1..5badf4f438 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -114,11 +114,11 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
}
if (s->listen) {
- if ((fd = ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
- s->listen_timeout, h)) < 0) {
- ret = fd;
+ if ((ret = ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
+ s->listen_timeout, h)) < 0) {
goto fail1;
}
+ fd = ret;
} else {
if ((ret = ff_listen_connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
s->timeout, h, !!cur_ai->ai_next)) < 0) {