changeset 5936:3671d661f4b5 libavformat

Fix leaks in the AAC RTP depacketizer
author mstorsjo
date Mon, 05 Apr 2010 17:25:39 +0000
parents bd378c64a9f5
children 97fce92200b5
files rtpdec.c rtpdec.h
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rtpdec.c	Mon Apr 05 16:13:51 2010 +0000
+++ b/rtpdec.c	Mon Apr 05 17:25:39 2010 +0000
@@ -400,7 +400,11 @@
         return -1;
 
     infos->nb_au_headers = au_headers_length / au_header_size;
+    if (!infos->au_headers || infos->au_headers_allocated < infos->nb_au_headers) {
+        av_free(infos->au_headers);
     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
+        infos->au_headers_allocated = infos->nb_au_headers;
+    }
 
     /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)
        In my test, the FAAD decoder does not behave correctly when sending each AU one by one
@@ -599,6 +603,8 @@
 void rtp_parse_close(RTPDemuxContext *s)
 {
     // TODO: fold this into the protocol specific data fields.
+    av_free(s->rtp_payload_data->mode);
+    av_free(s->rtp_payload_data->au_headers);
     if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) {
         ff_mpegts_parse_close(s->ts);
     }
--- a/rtpdec.h	Mon Apr 05 16:13:51 2010 +0000
+++ b/rtpdec.h	Mon Apr 05 17:25:39 2010 +0000
@@ -48,6 +48,7 @@
         int rap_flag;
         int streamstate;
     } *au_headers;
+    int au_headers_allocated;
     int nb_au_headers;
     int au_headers_length_bytes;
     int cur_au_index;