1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
James Almer 2018-03-20 00:55:27 -03:00
parent 039be6a23f
commit ae36d6cdde

View File

@ -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;