comparison rtpdec.c @ 5936:3671d661f4b5 libavformat

Fix leaks in the AAC RTP depacketizer
author mstorsjo
date Mon, 05 Apr 2010 17:25:39 +0000
parents e3b4d7181606
children 97fce92200b5
comparison
equal deleted inserted replaced
5935:bd378c64a9f5 5936:3671d661f4b5
398 au_header_size = infos->sizelength + infos->indexlength; 398 au_header_size = infos->sizelength + infos->indexlength;
399 if (au_header_size <= 0 || (au_headers_length % au_header_size != 0)) 399 if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
400 return -1; 400 return -1;
401 401
402 infos->nb_au_headers = au_headers_length / au_header_size; 402 infos->nb_au_headers = au_headers_length / au_header_size;
403 if (!infos->au_headers || infos->au_headers_allocated < infos->nb_au_headers) {
404 av_free(infos->au_headers);
403 infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers); 405 infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
406 infos->au_headers_allocated = infos->nb_au_headers;
407 }
404 408
405 /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving) 409 /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)
406 In my test, the FAAD decoder does not behave correctly when sending each AU one by one 410 In my test, the FAAD decoder does not behave correctly when sending each AU one by one
407 but does when sending the whole as one big packet... */ 411 but does when sending the whole as one big packet... */
408 infos->au_headers[0].size = 0; 412 infos->au_headers[0].size = 0;
597 } 601 }
598 602
599 void rtp_parse_close(RTPDemuxContext *s) 603 void rtp_parse_close(RTPDemuxContext *s)
600 { 604 {
601 // TODO: fold this into the protocol specific data fields. 605 // TODO: fold this into the protocol specific data fields.
606 av_free(s->rtp_payload_data->mode);
607 av_free(s->rtp_payload_data->au_headers);
602 if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) { 608 if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) {
603 ff_mpegts_parse_close(s->ts); 609 ff_mpegts_parse_close(s->ts);
604 } 610 }
605 av_free(s); 611 av_free(s);
606 } 612 }