[FFmpeg-devel] [PATCH] Free AVStream->info in chained muxers
Martin Storsjö
martin
Wed Feb 2 09:57:26 CET 2011
This fixes memory leaks in the RTSP muxer and RTP hinting in the
mov muxer present since SVN rev 25418.
---
The cleanup of muxers should probably be wrapped up in a normal
cleanup function, like av_close_input_stream for demuxers, but
that's for a later patch.
libavformat/movenchint.c | 2 ++
libavformat/rtpenc_chain.c | 1 +
libavformat/rtsp.c | 1 +
3 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c
index 2ebe8b8..2aa0f17 100644
--- a/libavformat/movenchint.c
+++ b/libavformat/movenchint.c
@@ -86,6 +86,7 @@ fail:
}
if (track->rtp_ctx && track->rtp_ctx->streams[0]) {
av_metadata_free(&track->rtp_ctx->streams[0]->metadata);
+ av_free(track->rtp_ctx->streams[0]->info);
av_free(track->rtp_ctx->streams[0]);
}
if (track->rtp_ctx) {
@@ -490,6 +491,7 @@ void ff_mov_close_hinting(MOVTrack *track) {
}
av_metadata_free(&rtp_ctx->streams[0]->metadata);
av_metadata_free(&rtp_ctx->metadata);
+ av_free(rtp_ctx->streams[0]->info);
av_free(rtp_ctx->streams[0]);
av_freep(&rtp_ctx);
}
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c
index 10d9df2..19ea98f 100644
--- a/libavformat/rtpenc_chain.c
+++ b/libavformat/rtpenc_chain.c
@@ -70,6 +70,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
url_close_dyn_buf(rtpctx->pb, &ptr);
av_free(ptr);
}
+ av_free(rtpctx->streams[0]->info);
av_free(rtpctx->streams[0]);
av_free(rtpctx);
return NULL;
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 09e2f1e..9c29c11 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -504,6 +504,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s)
}
av_metadata_free(&rtpctx->streams[0]->metadata);
av_metadata_free(&rtpctx->metadata);
+ av_free(rtpctx->streams[0]->info);
av_free(rtpctx->streams[0]);
av_free(rtpctx);
} else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
--
1.7.3.1
More information about the ffmpeg-devel
mailing list