lavf/udp: do not return an uninitialized value from udp_open()

(cherry picked from commit 3c2b674468)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
        libavformat/udp.c
This commit is contained in:
Anton Khirnov
2022-01-10 17:41:02 +01:00
parent 458c00ea0b
commit 91aa03952a

View File

@@ -740,8 +740,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
/* XXX: fix av_url_split */ /* XXX: fix av_url_split */
if (hostname[0] == '\0' || hostname[0] == '?') { if (hostname[0] == '\0' || hostname[0] == '?') {
/* only accepts null hostname if input */ /* only accepts null hostname if input */
if (!(flags & AVIO_FLAG_READ)) if (!(flags & AVIO_FLAG_READ)) {
ret = AVERROR(EINVAL);
goto fail; goto fail;
}
} else { } else {
if ((ret = ff_udp_set_remote_url(h, uri)) < 0) if ((ret = ff_udp_set_remote_url(h, uri)) < 0)
goto fail; goto fail;
@@ -754,8 +756,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
udp_fd = udp_socket_create(h, &my_addr, &len, localaddr); udp_fd = udp_socket_create(h, &my_addr, &len, localaddr);
else else
udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr); udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
if (udp_fd < 0) if (udp_fd < 0) {
ret = AVERROR(EIO);
goto fail; goto fail;
}
s->local_addr_storage=my_addr; //store for future multicast join s->local_addr_storage=my_addr; //store for future multicast join