diff --git a/libavformat/rdt.c b/libavformat/rdt.c index a6baf4616bb97967684d9979ccdd7feb487a41d9..2574496d2fd1f3839248ba11b9ebb131301300a1 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -543,7 +543,6 @@ rdt_free_context (PayloadContext *rdt) avformat_close_input(&rdt->rmctx); av_freep(&rdt->mlti_data); av_freep(&rdt->rmst); - av_free(rdt); } #define RDT_HANDLER(n, s, t) \ diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 9b7c36c6492d50ed00e1eb66f70f10c9271394a7..8992c38d3b3fc81b22938785b40554339094bce0 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -127,7 +127,9 @@ struct RTPDynamicProtocolHandler { /** Parse the a= line from the sdp field */ int (*parse_sdp_a_line)(AVFormatContext *s, int st_index, PayloadContext *priv_data, const char *line); - /** Free any data needed by the rtp parsing for this dynamic data. */ + /** Free any data needed by the rtp parsing for this dynamic data. + * Don't free the protocol_data pointer itself, that is freed by the + * caller. */ void (*free)(PayloadContext *protocol_data); /** Parse handler for this dynamic packet */ DynamicPayloadPacketHandlerProc parse_packet; diff --git a/libavformat/rtpdec_ac3.c b/libavformat/rtpdec_ac3.c index 4a793d48d33ec0e4f18ed39661abe915ba8972c3..480fdd0cd5d7f694a5237e216c88bd0e14bc1150 100644 --- a/libavformat/rtpdec_ac3.c +++ b/libavformat/rtpdec_ac3.c @@ -44,7 +44,6 @@ static void free_fragment(PayloadContext *data) static void ac3_free_context(PayloadContext *data) { free_fragment(data); - av_free(data); } static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data, diff --git a/libavformat/rtpdec_dv.c b/libavformat/rtpdec_dv.c index ce2d22de126328bf338458d8e89968faa6e0ee7f..c428322097c013a7c44417fc9585d217269835b3 100644 --- a/libavformat/rtpdec_dv.c +++ b/libavformat/rtpdec_dv.c @@ -42,7 +42,6 @@ static void dv_free_dyn_buffer(AVIOContext **dyn_buf) static av_cold void dv_free_context(PayloadContext *data) { dv_free_dyn_buffer(&data->buf); - av_free(data); } static av_cold int dv_sdp_parse_fmtp_config(AVFormatContext *s, diff --git a/libavformat/rtpdec_h261.c b/libavformat/rtpdec_h261.c index dac76c8ad7a27d252a9c32d631ab132c12bf01cc..b2d2a53f1cb314fcca0a70e6afac1b8e6189d19c 100644 --- a/libavformat/rtpdec_h261.c +++ b/libavformat/rtpdec_h261.c @@ -50,9 +50,6 @@ static av_cold void h261_free_context(PayloadContext *pl_ctx) if (pl_ctx->buf) { h261_free_dyn_buffer(&pl_ctx->buf); } - - /* free context */ - av_free(pl_ctx); } static int h261_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_h261_ctx, diff --git a/libavformat/rtpdec_h263_rfc2190.c b/libavformat/rtpdec_h263_rfc2190.c index ae6e38ecfe57c061a4eb8ca635a756945a0f3201..e45778108b1be549749b85e130ce3b2a1651c2ff 100644 --- a/libavformat/rtpdec_h263_rfc2190.c +++ b/libavformat/rtpdec_h263_rfc2190.c @@ -46,7 +46,6 @@ static void h263_free_context(PayloadContext *data) avio_close_dyn_buf(data->buf, &p); av_free(p); } - av_free(data); } static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index a74be1fc0558775b611e4f3e032b33f8f8d72742..99365d67450ca9e3af3decf87b8eb05171b5be30 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -382,8 +382,6 @@ static void h264_free_context(PayloadContext *data) data->packet_types_received[ii], ii); } #endif - - av_free(data); } static int parse_h264_sdp_line(AVFormatContext *s, int st_index, diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c index b49185a751e576bb19a51650ff6a12a5def9a692..0bc9eea13cb3d207de1bc9e22fdbb66a05a2ee9f 100644 --- a/libavformat/rtpdec_jpeg.c +++ b/libavformat/rtpdec_jpeg.c @@ -72,7 +72,6 @@ static void free_frame(PayloadContext *jpeg) static void jpeg_free_context(PayloadContext *jpeg) { free_frame(jpeg); - av_free(jpeg); } static int jpeg_create_huffman_table(PutByteContext *p, int table_class, diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c index 6d5b46a72651d2613c825353bc1191ef5fe783f9..3ee552e414e38c30e963b0a978606e915c6007ac 100644 --- a/libavformat/rtpdec_latm.c +++ b/libavformat/rtpdec_latm.c @@ -39,7 +39,6 @@ static void latm_free_context(PayloadContext *data) av_free(p); } av_free(data->buf); - av_free(data); } static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data, diff --git a/libavformat/rtpdec_mpa_robust.c b/libavformat/rtpdec_mpa_robust.c index d7a01049b049965f6623bf2b48496c2e880dfbc0..46e9f36e8d9241b4ae0ddcd2118133628eff71b2 100644 --- a/libavformat/rtpdec_mpa_robust.c +++ b/libavformat/rtpdec_mpa_robust.c @@ -47,7 +47,6 @@ static void mpa_robust_free_context(PayloadContext *data) { free_fragment(data); av_free(data->split_buf); - av_free(data); } static int mpa_robust_parse_rtp_header(AVFormatContext *ctx, diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c index 3fb89372aeee9749c316ebe22cbec2ee69323228..b5dc2eb157135dde9120d91dd7f92f73fe10352f 100644 --- a/libavformat/rtpdec_mpeg4.c +++ b/libavformat/rtpdec_mpeg4.c @@ -95,7 +95,6 @@ static void free_context(PayloadContext *data) { av_free(data->au_headers); av_free(data->mode); - av_free(data); } static int parse_fmtp_config(AVCodecContext *codec, const char *value) diff --git a/libavformat/rtpdec_mpegts.c b/libavformat/rtpdec_mpegts.c index 5ef17cbdf1ad0883c753636ef79b1f53586bf28c..72e11a8af24e35812e241b45f3f2a35e6ae2abb7 100644 --- a/libavformat/rtpdec_mpegts.c +++ b/libavformat/rtpdec_mpegts.c @@ -36,7 +36,6 @@ static void mpegts_free_context(PayloadContext *data) return; if (data->ts) ff_mpegts_parse_close(data->ts); - av_free(data); } static av_cold int mpegts_init(AVFormatContext *ctx, int st_index, diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 7c14bada56e8dd36066de08096a5d8ffe6885b0f..3836a955e75ac2d2600f2580ec1de9021020fac3 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -238,7 +238,6 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, static void qt_rtp_free(PayloadContext *qt) { av_freep(&qt->pkt.data); - av_free(qt); } #define RTP_QT_HANDLER(m, n, s, t) \ diff --git a/libavformat/rtpdec_svq3.c b/libavformat/rtpdec_svq3.c index d2c0a0b2b235f45acb5973cbdcf247cea37a6685..4667c75cb8f84ef4e4d6ea86110ce08c8ad4fe5e 100644 --- a/libavformat/rtpdec_svq3.c +++ b/libavformat/rtpdec_svq3.c @@ -116,7 +116,6 @@ static void svq3_extradata_free(PayloadContext *sv) avio_close_dyn_buf(sv->pktbuf, &buf); av_free(buf); } - av_free(sv); } RTPDynamicProtocolHandler ff_svq3_dynamic_handler = { diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c index 4701316b2ff14c387aa77006978983b10b920bac..9fa5afa6299d0af35d1f7ed15c5730c6fb6917b1 100644 --- a/libavformat/rtpdec_vp8.c +++ b/libavformat/rtpdec_vp8.c @@ -278,7 +278,6 @@ static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp static void vp8_free_context(PayloadContext *vp8) { vp8_free_buffer(vp8); - av_free(vp8); } static int vp8_need_keyframe(PayloadContext *vp8) diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c index a9d3fbbe004578c0f84aec780d0140d413895011..5d0dc69dc21c194b460c3013848661f08b588c7f 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -63,7 +63,6 @@ static void xiph_free_context(PayloadContext * data) { free_fragment(data); av_free(data->split_buf); - av_free(data); } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 3180d5bb9451ff96bda5e093af81bbfd912be5be..50cefb09bcc79b8954469f780c7d6189d48f7d09 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -725,8 +725,7 @@ void ff_rtsp_close_streams(AVFormatContext *s) if (rtsp_st->dynamic_handler->free) rtsp_st->dynamic_handler->free( rtsp_st->dynamic_protocol_context); - else - av_free(rtsp_st->dynamic_protocol_context); + av_free(rtsp_st->dynamic_protocol_context); } for (j = 0; j < rtsp_st->nb_include_source_addrs; j++) av_free(rtsp_st->include_source_addrs[j]);