summaryrefslogtreecommitdiffstats
path: root/libavcodec/h265_metadata_bsf.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-20 00:55:27 -0300
committerJames Almer <jamrial@gmail.com>2018-03-20 18:20:29 -0300
commitae36d6cdde0799099dee0397427438bfc86bc1d9 (patch)
treec5800ae70adc28a692c6448e32ce586cd5bf0cea /libavcodec/h265_metadata_bsf.c
parent039be6a23f4399a6a020a03be68e4c7cd5aaed2b (diff)
downloadffmpeg-streaming-ae36d6cdde0799099dee0397427438bfc86bc1d9.zip
ffmpeg-streaming-ae36d6cdde0799099dee0397427438bfc86bc1d9.tar.gz
avcodec/h265_metadata: fix memory leak in case of output packet creation failure
Some function calls may fail after the output packet is initialized. Reviewed-by: jkqxz Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/h265_metadata_bsf.c')
-rw-r--r--libavcodec/h265_metadata_bsf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h265_metadata_bsf.c b/libavcodec/h265_metadata_bsf.c
index 8759e41..26eb2d0 100644
--- a/libavcodec/h265_metadata_bsf.c
+++ b/libavcodec/h265_metadata_bsf.c
@@ -239,7 +239,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *out)
err = ff_bsf_get_packet(bsf, &in);
if (err < 0)
- goto fail;
+ return err;
err = ff_cbs_read_packet(ctx->cbc, au, in);
if (err < 0) {
@@ -324,6 +324,8 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *out)
fail:
ff_cbs_fragment_uninit(ctx->cbc, au);
+ if (err < 0)
+ av_packet_unref(out);
av_packet_free(&in);
return err;
OpenPOWER on IntegriCloud