[libav-stable] rtpproto: Free the addrinfo pointer on failure

Luca Barbato git at libav.org
Mon Oct 20 13:25:12 CEST 2014


Module: libav
Branch: master
Commit: d2771a1dc0a3695e8873adc16d068077f2417eea

Author:    Luca Barbato <lu_zero at gentoo.org>
Committer: Vittorio Giovara <vittorio.giovara at gmail.com>
Date:      Sat Oct 18 16:58:41 2014 +0100

rtpproto: Free the addrinfo pointer on failure

CC: libav-stable at libav.org
Bug-Id: CID 1238797

---

 libavformat/rtpproto.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 0f31539..d5ecfc8 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -231,8 +231,10 @@ static void rtp_parse_addr_list(URLContext *h, char *buf,
         ai = rtp_resolve_host(p, 0, SOCK_DGRAM, AF_UNSPEC, 0);
         if (ai) {
             source_addr = av_mallocz(sizeof(struct sockaddr_storage));
-            if (!source_addr)
+            if (!source_addr) {
+                freeaddrinfo(ai);
                 break;
+            }
 
             memcpy(source_addr, ai->ai_addr, ai->ai_addrlen);
             freeaddrinfo(ai);



More information about the libav-stable mailing list