diff options
author | Anders Nystrom <anders.nystrom@southpole.se> | 2015-04-09 02:38:41 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-04-09 14:32:37 +0200 |
commit | 27852f2f1dec3749ea79883b70484c841169f747 (patch) | |
tree | 2d05918162c4a5d6ead0dac3fe64f6d4ff5c5088 /libavformat/unix.c | |
parent | 0266988ccd15436eaf5f7bb6f9509e6bfd5ce589 (diff) | |
download | ffmpeg-27852f2f1dec3749ea79883b70484c841169f747.tar.gz |
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/unix.c')
-rw-r--r-- | libavformat/unix.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavformat/unix.c b/libavformat/unix.c index 5c6f576487..72b8fcdbbb 100644 --- a/libavformat/unix.c +++ b/libavformat/unix.c @@ -75,12 +75,11 @@ static int unix_open(URLContext *h, const char *filename, int flags) return ff_neterrno(); if (s->listen) { - fd = ff_listen_bind(fd, (struct sockaddr *)&s->addr, - sizeof(s->addr), s->timeout, h); - if (fd < 0) { - ret = fd; + ret = ff_listen_bind(fd, (struct sockaddr *)&s->addr, + sizeof(s->addr), s->timeout, h); + if (ret < 0) goto fail; - } + fd = ret; } else { ret = ff_listen_connect(fd, (struct sockaddr *)&s->addr, sizeof(s->addr), s->timeout, h, 0); |