[vlc-devel] commit: Do not leak memory in case of multiple region inside a subpicture. (Laurent Aimar )

git version control git at videolan.org
Sun Jul 27 21:24:24 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Jul 27 21:26:10 2008 +0200| [a1b9a8489fe396d873d932b9baa6c0e05a696949]

Do not leak memory in case of multiple region inside a subpicture.

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

 src/video_output/vout_subpictures.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index e6abb43..5e6b6e6 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -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




More information about the vlc-devel mailing list