You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
@@ -225,7 +225,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
|
|||||||
|
|
||||||
err = ff_bsf_get_packet(bsf, &in);
|
err = ff_bsf_get_packet(bsf, &in);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
return err;
|
||||||
|
|
||||||
err = ff_cbs_read_packet(ctx->cbc, au, in);
|
err = ff_cbs_read_packet(ctx->cbc, au, in);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
@@ -545,6 +545,8 @@ fail:
|
|||||||
ff_cbs_fragment_uninit(ctx->cbc, au);
|
ff_cbs_fragment_uninit(ctx->cbc, au);
|
||||||
av_freep(&displaymatrix_side_data);
|
av_freep(&displaymatrix_side_data);
|
||||||
|
|
||||||
|
if (err < 0)
|
||||||
|
av_packet_unref(out);
|
||||||
av_packet_free(&in);
|
av_packet_free(&in);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user