Commit 81b4850d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

kva: fix double free on error, and remove useless struct member

parent 828af6fe
...@@ -101,7 +101,6 @@ struct vout_display_sys_t ...@@ -101,7 +101,6 @@ struct vout_display_sys_t
HWND parent; HWND parent;
RECTL parent_rect; RECTL parent_rect;
picture_pool_t *pool; picture_pool_t *pool;
picture_resource_t resource;
unsigned button_pressed; unsigned button_pressed;
bool is_mouse_hidden; bool is_mouse_hidden;
bool is_on_top; bool is_on_top;
...@@ -657,24 +656,19 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt ) ...@@ -657,24 +656,19 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
} }
/* Create the associated picture */ /* Create the associated picture */
picture_resource_t *rsc = &sys->resource; picture_sys_t *picsys = malloc( sizeof( *picsys ) );
rsc->p_sys = malloc( sizeof( *rsc->p_sys )); if( picsys == NULL )
if( !rsc->p_sys ) return VLC_ENOMEM;
return VLC_EGENERIC; picsys->i_chroma_shift = i_chroma_shift;
rsc->p_sys->i_chroma_shift = i_chroma_shift;
for( int i = 0; i < PICTURE_PLANE_MAX; i++ ) picture_resource_t resource = { .p_sys = picsys };
picture_t *picture = picture_NewFromResource( fmt, &resource );
if( !picture )
{ {
rsc->p[ i ].p_pixels = NULL; free( picsys );
rsc->p[ i ].i_pitch = 0; return VLC_ENOMEM;
rsc->p[ i ].i_lines = 0;
} }
picture_t *picture = picture_NewFromResource( fmt, rsc );
if( !picture )
goto exit_picture;
/* Wrap it into a picture pool */ /* Wrap it into a picture pool */
picture_pool_configuration_t pool_cfg; picture_pool_configuration_t pool_cfg;
memset( &pool_cfg, 0, sizeof( pool_cfg )); memset( &pool_cfg, 0, sizeof( pool_cfg ));
...@@ -687,8 +681,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt ) ...@@ -687,8 +681,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
if( !sys->pool ) if( !sys->pool )
{ {
picture_Release( picture ); picture_Release( picture );
return VLC_ENOMEM;
goto exit_picture;
} }
if (vd->cfg->display.title) if (vd->cfg->display.title)
...@@ -726,11 +719,6 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt ) ...@@ -726,11 +719,6 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
SWP_ACTIVATE ); SWP_ACTIVATE );
return VLC_SUCCESS; return VLC_SUCCESS;
exit_picture:
free( rsc->p_sys );
return VLC_EGENERIC;
} }
/***************************************************************************** /*****************************************************************************
......
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