]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/cfhdenc: free alpha buffer on closing
authorPaul B Mahol <onemda@gmail.com>
Sat, 8 Aug 2020 17:59:06 +0000 (19:59 +0200)
committerPaul B Mahol <onemda@gmail.com>
Sat, 8 Aug 2020 17:59:06 +0000 (19:59 +0200)
libavcodec/cfhdenc.c

index 8030413548cba70c60d0b88b0d3f46b0fd1dcf90..d53604ae110d5475b818c3aa8ca646ef8d23656b 100644 (file)
@@ -356,6 +356,9 @@ static av_cold int cfhd_encode_init(AVCodecContext *avctx)
             s->lut[i] = last;
     }
 
+    if (s->planes != 4)
+        return 0;
+
     s->alpha = av_calloc(avctx->width * avctx->height, sizeof(*s->alpha));
     if (!s->alpha)
         return AVERROR(ENOMEM);
@@ -864,6 +867,8 @@ static av_cold int cfhd_encode_close(AVCodecContext *avctx)
             s->plane[i].l_h[j] = NULL;
     }
 
+    av_freep(&s->alpha);
+
     return 0;
 }