avcodec/bsf: check that AVBSFInternal was allocated before dereferencing it

This can happen when av_bsf_free() is called on av_bsf_alloc() failure.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2019-09-22 23:55:49 -03:00
parent eaf3c4b8bf
commit d889ae3396
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ void av_bsf_free(AVBSFContext **pctx)
av_opt_free(ctx);
av_packet_free(&ctx->internal->buffer_pkt);
if (ctx->internal)
av_packet_free(&ctx->internal->buffer_pkt);
av_freep(&ctx->internal);
av_freep(&ctx->priv_data);