]> git.sesse.net Git - vlc/commitdiff
Do not leak memory in case of multiple region inside a subpicture.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 27 Jul 2008 19:26:10 +0000 (21:26 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 27 Jul 2008 19:27:01 +0000 (21:27 +0200)
src/video_output/vout_subpictures.c

index e6abb43579363a1b54abe6b4f5d901677cb3b87b..5e6b6e6123fb857416ac721cc0a9848448f41d4d 100644 (file)
@@ -998,10 +998,12 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
 
         if( p_subpic->pf_update_regions )
         {
-            /* FIXME that part look like crap too if there is more than 1 region */
-
-            if( p_subpic->p_region )
-                spu_DestroyRegion( p_spu, p_subpic->p_region );
+            while( p_subpic->p_region )
+            {
+                subpicture_region_t *p_region = p_subpic->p_region;
+                p_subpic->p_region = p_region->p_next;
+                spu_DestroyRegion( p_spu, p_region );
+            }
 
             /* TODO do not reverse the scaling that was done before calling
              * spu_RenderSubpictures, just pass it along (or do it inside