[FFmpeg-cvslog] avformat/matroskaenc: Fix potential leak of cached packet
Andreas Rheinhardt
git at videolan.org
Sun Nov 24 23:49:54 EET 2019
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Nov 6 03:49:01 2019 +0100| [4470ab1e0ee1c36cca83f161567177145f412605] | committer: Michael Niedermayer
avformat/matroskaenc: Fix potential leak of cached packet
If mkv_write_trailer() is not called, the cached audio packet might
leak; so unref it in mkv_deinit().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4470ab1e0ee1c36cca83f161567177145f412605
---
libavformat/matroskaenc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index ba48aae454..ce08b1b338 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -390,6 +390,8 @@ static void mkv_deinit(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
+ av_packet_unref(&mkv->cur_audio_pkt);
+
ffio_free_dyn_buf(&mkv->cluster_bc);
ffio_free_dyn_buf(&mkv->info_bc);
ffio_free_dyn_buf(&mkv->tracks_bc);
@@ -2534,7 +2536,6 @@ static int mkv_write_trailer(AVFormatContext *s)
// check if we have an audio packet cached
if (mkv->cur_audio_pkt.size > 0) {
ret = mkv_write_packet_internal(s, &mkv->cur_audio_pkt, 0);
- av_packet_unref(&mkv->cur_audio_pkt);
if (ret < 0) {
av_log(s, AV_LOG_ERROR,
"Could not write cached audio packet ret:%d\n", ret);
More information about the ffmpeg-cvslog
mailing list