diff options
author | James Almer <jamrial@gmail.com> | 2018-03-20 00:55:26 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2018-03-20 18:19:20 -0300 |
commit | 039be6a23f4399a6a020a03be68e4c7cd5aaed2b (patch) | |
tree | 18facf6ebf92ca04ccf8b98640bf1028d74b8eff | |
parent | bd60116794b4baaf9a6fedfc68cb1ac4a383bb2d (diff) | |
download | ffmpeg-streaming-039be6a23f4399a6a020a03be68e4c7cd5aaed2b.zip ffmpeg-streaming-039be6a23f4399a6a020a03be68e4c7cd5aaed2b.tar.gz |
avcodec/h264_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>
-rw-r--r-- | libavcodec/h264_metadata_bsf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index e1f0c43..27053db 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -225,7 +225,7 @@ static int h264_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) { @@ -545,6 +545,8 @@ fail: ff_cbs_fragment_uninit(ctx->cbc, au); av_freep(&displaymatrix_side_data); + if (err < 0) + av_packet_unref(out); av_packet_free(&in); return err; |