mirror of https://git.ffmpeg.org/ffmpeg.git
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>
This commit is contained in:
parent
0266988ccd
commit
27852f2f1d
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue