[FFmpeg-devel] [PATCH] avcodec/trace_headers: always unref the input packet

James Almer jamrial at gmail.com
Sat Mar 24 06:07:51 EET 2018


On 3/24/2018 1:02 AM, James Almer wrote:
> ff_cbs_read_packet() does not take ownership of it.
> 
> Regression since c266049191.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/trace_headers_bsf.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c
> index 94a3ef72a2..f197f6168e 100644
> --- a/libavcodec/trace_headers_bsf.c
> +++ b/libavcodec/trace_headers_bsf.c
> @@ -98,13 +98,16 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
>  
>      err = ff_cbs_read_packet(ctx->cbc, &au, pkt);
>      if (err < 0) {
> -        av_packet_unref(pkt);
> -        return err;
> +        goto fail;
>      }
>  
>      ff_cbs_fragment_uninit(ctx->cbc, &au);
>  
> -    return 0;
> +    err = 0;
> +fail:
> +    av_packet_unref(pkt);
> +
> +    return err;
>  }
>  
>  const AVBitStreamFilter ff_trace_headers_bsf = {
> 

Disregard this patch. I misread what the filter was trying to do.

Sorry for the noise.


More information about the ffmpeg-devel mailing list