Commit 85c962c6 authored by Dennis van Amerongen's avatar Dennis van Amerongen

* src/video_output/vout_subpictures.c: backport [20562], potential memleak/crash

parent 779b6790
...@@ -251,6 +251,8 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this, ...@@ -251,6 +251,8 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
video_format_t *p_fmt ) video_format_t *p_fmt )
{ {
subpicture_region_t *p_region = malloc( sizeof(subpicture_region_t) ); subpicture_region_t *p_region = malloc( sizeof(subpicture_region_t) );
if( !p_region ) return NULL;
memset( p_region, 0, sizeof(subpicture_region_t) ); memset( p_region, 0, sizeof(subpicture_region_t) );
p_region->p_next = 0; p_region->p_next = 0;
p_region->p_cache = 0; p_region->p_cache = 0;
...@@ -273,7 +275,7 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this, ...@@ -273,7 +275,7 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
if( !p_region->picture.i_planes ) if( !p_region->picture.i_planes )
{ {
free( p_region ); free( p_region );
free( p_fmt->p_palette ); if( p_fmt->p_palette ) free( p_fmt->p_palette );
return NULL; return NULL;
} }
...@@ -635,8 +637,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -635,8 +637,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
} }
/* Force palette if requested */ /* Force palette if requested */
if( p_spu->b_force_palette && VLC_FOURCC('Y','U','V','P') == if( p_spu->b_force_palette &&
p_region->fmt.i_chroma ) (VLC_FOURCC('Y','U','V','P') == p_region->fmt.i_chroma) )
{ {
memcpy( p_region->fmt.p_palette->palette, memcpy( p_region->fmt.p_palette->palette,
p_spu->palette, 16 ); p_spu->palette, 16 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment