[FFmpeg-devel] [PATCH 3/3] avcodec/mpeg2_metadata: fix memory leak in case of output packet creation failure
James Almer
jamrial at gmail.com
Tue Mar 20 05:55:28 EET 2018
Some function calls may fail after the output packet is initialized.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/mpeg2_metadata_bsf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c
index 6d5f581ab1..aa447db0b8 100644
--- a/libavcodec/mpeg2_metadata_bsf.c
+++ b/libavcodec/mpeg2_metadata_bsf.c
@@ -218,6 +218,8 @@ static int mpeg2_metadata_filter(AVBSFContext *bsf, AVPacket *out)
fail:
ff_cbs_fragment_uninit(ctx->cbc, frag);
+ if (err < 0)
+ av_packet_unref(&out);
av_packet_free(&in);
return err;
--
2.16.2
More information about the ffmpeg-devel
mailing list