[vlc-commits] avcodec: fix invalid write and memory leak

Rémi Denis-Courmont git at videolan.org
Tue Apr 12 23:37:13 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 13 00:33:02 2016 +0300| [c65d02805c39a646cf57c9744176d79f1a640c87] | committer: Rémi Denis-Courmont

avcodec: fix invalid write and memory leak

picture.format is set by the allocator of the picture. It cannot be
changed. Indeed, this caused a massive leak (one palette per picture).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c65d02805c39a646cf57c9744176d79f1a640c87
---

 modules/codec/avcodec/video.c |   13 -------------
 1 file changed, 13 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 143634c..f4666c6 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -246,19 +246,6 @@ static void lavc_CopyPicture(decoder_t *dec, picture_t *pic, AVFrame *frame)
             dst += dst_stride;
         }
     }
-
-    if (unlikely(sys->p_context->pix_fmt == AV_PIX_FMT_PAL8))
-    {
-        if (pic->format.p_palette == NULL)
-            pic->format.p_palette = calloc(1, sizeof (video_palette_t));
-
-        if (likely(pic->format.p_palette != NULL))
-        {
-            pic->format.p_palette->i_entries = AVPALETTE_COUNT;
-            memcpy(pic->format.p_palette->palette, frame->data[1],
-                   AVPALETTE_SIZE);
-        }
-    }
 }
 
 static int OpenVideoCodec( decoder_t *p_dec )



More information about the vlc-commits mailing list