]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/qtrleenc: Fix memleak upon allocation failure
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 12 Sep 2020 21:52:36 +0000 (23:52 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 16 Sep 2020 22:09:08 +0000 (00:09 +0200)
The qtrle encoder allocates several buffers and an AVFrame in its init
function. If one of these allocations fails, but others succeed, the
successfully allocated objects leak. This is fixed by setting the
FF_CODEC_CAP_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/qtrleenc.c

index 6669c1302f934eff1d35f8f533994ca5c63b48d5..8b0edf7b3d8bb6189934916ce1be261d85ebfe0e 100644 (file)
@@ -413,4 +413,5 @@ AVCodec ff_qtrle_encoder = {
     .pix_fmts       = (const enum AVPixelFormat[]){
         AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB555BE, AV_PIX_FMT_ARGB, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
     },
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };