Commit db9941a7 authored by Filip Roséen's avatar Filip Roséen Committed by Thomas Guillem
Browse files

input/control: INPUT_CHANGE_BOOKMARK: fix leak and return



The previous implementation would potentially try to duplicate a
seekpoint that was never used due to invalid arguments, as well as
leaking said duplicate.

These changes make sure that we do not leak the resource, while also
preventing the unnecessary duplication + returning an error if
we are unable to complete the operation.

CID: 1409711
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 8a5ef654
......@@ -222,22 +222,22 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
p_bkmk = va_arg( args, seekpoint_t * );
i_bkmk = va_arg( args, int );
p_bkmk = vlc_seekpoint_Duplicate( p_bkmk );
if( !p_bkmk )
return VLC_EGENERIC;
vlc_mutex_lock( &priv->p_item->lock );
if( i_bkmk < priv->i_bookmark )
{
vlc_seekpoint_Delete( priv->pp_bookmark[i_bkmk] );
priv->pp_bookmark[i_bkmk] = p_bkmk;
p_bkmk = vlc_seekpoint_Duplicate( p_bkmk );
if( p_bkmk )
{
vlc_seekpoint_Delete( priv->pp_bookmark[i_bkmk] );
priv->pp_bookmark[i_bkmk] = p_bkmk;
}
}
else p_bkmk = NULL;
vlc_mutex_unlock( &priv->p_item->lock );
UpdateBookmarksOption( p_input );
return VLC_SUCCESS;
return p_bkmk ? VLC_SUCCESS : VLC_EGENERIC;
case INPUT_DEL_BOOKMARK:
i_bkmk = va_arg( args, int );
......
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