[FFmpeg-cvslog] avcodec/mpeg2_metadata: unref output packet on failure

James Almer git at videolan.org
Tue Mar 20 23:31:45 EET 2018


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Mar 20 00:55:28 2018 -0300| [2aac5ad2f72cf9a1f024187b78f949c5613ceacd] | committer: James Almer

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2aac5ad2f72cf9a1f024187b78f949c5613ceacd
---

 libavcodec/mpeg2_metadata_bsf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c
index 6d5f581ab1..e787cb3782 100644
--- a/libavcodec/mpeg2_metadata_bsf.c
+++ b/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;



More information about the ffmpeg-cvslog mailing list