]> git.sesse.net Git - vlc/commitdiff
Fixed subtitle/osd memory leaks (subpicture_region_t->psz_text was not freed).
authorLaurent Aimar <fenrir@videolan.org>
Thu, 22 Feb 2007 20:43:28 +0000 (20:43 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 22 Feb 2007 20:43:28 +0000 (20:43 +0000)
 I think we have a potential bug with the way subpicture_region_t->p_style
is used.
 Decoders allocate p_style memory in their context, so we don't free it in
spu_DestroyRegion. As vout object can live longer than decoder, I think
p_style might be used after the decoder has destroyed it.

 Can someone, who has worked on osd/spu internal, comment ?

src/video_output/vout_subpictures.c

index 6a1fda227448034172e31675cf17e1f394ff887c..fb412a8ffc0200c977223bd0c907d22b7d689aa4 100644 (file)
@@ -329,6 +329,10 @@ void __spu_DestroyRegion( vlc_object_t *p_this, subpicture_region_t *p_region )
         p_region->picture.pf_release( &p_region->picture );
     if( p_region->fmt.p_palette ) free( p_region->fmt.p_palette );
     if( p_region->p_cache ) __spu_DestroyRegion( p_this, p_region->p_cache );
+
+    if( p_region->psz_text )
+        free( p_region->psz_text );
+    //free( p_region->p_style ); FIXME --fenrir plugin does not allocate the memory for it. I think it might lead to segfault, video renderer can live longer than the decoder
     free( p_region );
 }