avcodec/bsf: check that AVBSFInternal was allocated before dereferencing it
authorJames Almer <jamrial@gmail.com>
Mon, 23 Sep 2019 02:55:49 +0000 (23:55 -0300)
committerJames Almer <jamrial@gmail.com>
Mon, 23 Sep 2019 13:02:03 +0000 (10:02 -0300)
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>
libavcodec/bsf.c

index 71915de..c1653cd 100644 (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);