rtpproto: Free the addrinfo pointer on failure

CC: libav-stable@libav.org
Bug-Id: CID 1238797
pull/87/merge
Luca Barbato 10 years ago committed by Vittorio Giovara
parent 96bfb67747
commit d2771a1dc0
  1. 4
      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); ai = rtp_resolve_host(p, 0, SOCK_DGRAM, AF_UNSPEC, 0);
if (ai) { if (ai) {
source_addr = av_mallocz(sizeof(struct sockaddr_storage)); source_addr = av_mallocz(sizeof(struct sockaddr_storage));
if (!source_addr) if (!source_addr) {
freeaddrinfo(ai);
break; break;
}
memcpy(source_addr, ai->ai_addr, ai->ai_addrlen); memcpy(source_addr, ai->ai_addr, ai->ai_addrlen);
freeaddrinfo(ai); freeaddrinfo(ai);

Loading…
Cancel
Save