diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2008-08-23 17:39:56 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2008-08-23 17:39:56 +0000 |
commit | e6c13819825aab796965a96ffb451cd008eab647 (patch) | |
tree | 6e45aa7c44cc9bba91337aefdfbf4768a10cf851 /libavformat/udp.c | |
parent | ad33bfefc7e1a0ddc9569bfc480835cf2fd80272 (diff) | |
download | ffmpeg-e6c13819825aab796965a96ffb451cd008eab647.tar.gz |
Fix memleak on some OSes in case network initialization fails. See
"[PATCH] tcp.c/udp.c memleak?" for discussion.
Originally committed as revision 14923 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/udp.c')
-rw-r--r-- | libavformat/udp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c index effe6992ec..1730130730 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -348,6 +348,9 @@ static int udp_open(URLContext *h, const char *uri, int flags) is_output = (flags & URL_WRONLY); + if(!ff_network_init()) + return AVERROR(EIO); + s = av_mallocz(sizeof(UDPContext)); if (!s) return AVERROR(ENOMEM); @@ -380,9 +383,6 @@ static int udp_open(URLContext *h, const char *uri, int flags) udp_set_remote_url(h, uri); } - if(!ff_network_init()) - return AVERROR(EIO); - if (s->is_multicast && !(h->flags & URL_WRONLY)) s->local_port = port; udp_fd = udp_socket_create(s, &my_addr, &len); |