aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/udp.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2005-02-24 19:08:50 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-02-24 19:08:50 +0000
commit88730be65153f4a59916d971842fdaed3e0fd72b (patch)
tree1f49c5812d2382abb53df216aab8cabc3c3f56b9 /libavformat/udp.c
parent53513831da58cae7603dc01270c1cf8e4252eba0 (diff)
downloadffmpeg-88730be65153f4a59916d971842fdaed3e0fd72b.tar.gz
kill warnings patch by (Måns Rullgård <mru inprovide com>)
Originally committed as revision 3977 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/udp.c')
-rw-r--r--libavformat/udp.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c
index b95f238d26..8b5fc32a2c 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -160,14 +160,14 @@ int udp_ipv6_set_local(URLContext *h) {
socklen_t addrlen;
char sbuf[NI_MAXSERV];
char hbuf[NI_MAXHOST];
- struct addrinfo *res0;
+ struct addrinfo *res0 = NULL;
int family;
if (s->local_port != 0) {
res0 = udp_ipv6_resolve_host(0, s->local_port, SOCK_DGRAM, AF_UNSPEC, AI_PASSIVE);
- if (res0 == 0) return -1;
+ if (res0 == 0)
+ goto fail;
family = res0->ai_family;
- freeaddrinfo(res0);
} else {
family = s->dest_addr.ss_family;
}
@@ -183,6 +183,8 @@ int udp_ipv6_set_local(URLContext *h) {
perror("bind");
goto fail;
}
+ freeaddrinfo(res0);
+ res0 = NULL;
}
addrlen = sizeof(clientaddr);
@@ -207,6 +209,8 @@ int udp_ipv6_set_local(URLContext *h) {
#else
close(udp_fd);
#endif
+ if(res0)
+ freeaddrinfo(res0);
return -1;
}
@@ -274,13 +278,16 @@ int udp_get_file_handle(URLContext *h)
/* return non zero if error */
static int udp_open(URLContext *h, const char *uri, int flags)
{
- struct sockaddr_in my_addr, my_addr1;
char hostname[1024];
int port, udp_fd = -1, tmp;
UDPContext *s = NULL;
- int is_output, len;
+ int is_output;
const char *p;
char buf[256];
+#ifndef CONFIG_IPV6
+ struct sockaddr_in my_addr, my_addr1;
+ int len;
+#endif
h->is_streamed = 1;
h->max_packet_size = 1472;