]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/extract_extradata_bsf: Don't unref uninitialized buffers
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 30 Nov 2019 06:38:10 +0000 (07:38 +0100)
committerJames Almer <jamrial@gmail.com>
Sat, 30 Nov 2019 12:59:30 +0000 (09:59 -0300)
This happens if allocating extradata fails and s->remove is unset.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/extract_extradata_bsf.c

index ff111de48cb006f00763f07885d7f2211d2ac683..15ffed6ba0547a365d44d19476f975a1cf124c2e 100644 (file)
@@ -85,7 +85,7 @@ static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt,
     }
 
     if (extradata_size && has_seq) {
-        AVBufferRef *filtered_buf;
+        AVBufferRef *filtered_buf = NULL;
         uint8_t *extradata, *filtered_data;
 
         if (s->remove) {
@@ -179,7 +179,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
     if (extradata_size &&
         ((ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps) ||
          (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) {
-        AVBufferRef *filtered_buf;
+        AVBufferRef *filtered_buf = NULL;
         uint8_t *extradata, *filtered_data;
 
         if (s->remove) {