avcodec/cbs_av1: ensure Sequence Header unit content is always reference counted

Prevents a NULL pointer dereference.

Signed-off-by: James Almer <jamrial@gmail.com>
pull/358/head
James Almer 4 years ago
parent 052b4c3481
commit 233a99e191
  1. 4
      libavcodec/cbs_av1.c

@ -1076,6 +1076,10 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
av_buffer_unref(&priv->sequence_header_ref);
priv->sequence_header = NULL;
err = ff_cbs_make_unit_refcounted(ctx, unit);
if (err < 0)
return err;
priv->sequence_header_ref = av_buffer_ref(unit->content_ref);
if (!priv->sequence_header_ref)
return AVERROR(ENOMEM);

Loading…
Cancel
Save