avcodec/mpeg2_metadata: unref output packet on failure

Move the check and unref call to the end to be consistent with other
bsfs.

Reviewed-by: jkqxz
Signed-off-by: James Almer <jamrial@gmail.com>
pull/283/head
James Almer 7 years ago
parent ae36d6cdde
commit 2aac5ad2f7
  1. 8
      libavcodec/mpeg2_metadata_bsf.c

@ -188,7 +188,7 @@ static int mpeg2_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, frag, in);
if (err < 0) {
@ -209,15 +209,15 @@ static int mpeg2_metadata_filter(AVBSFContext *bsf, AVPacket *out)
}
err = av_packet_copy_props(out, in);
if (err < 0) {
av_packet_unref(out);
if (err < 0)
goto fail;
}
err = 0;
fail:
ff_cbs_fragment_uninit(ctx->cbc, frag);
if (err < 0)
av_packet_unref(out);
av_packet_free(&in);
return err;

Loading…
Cancel
Save