[vlc-devel] [PATCH] playlist: fix missing NULL test

Steve Lhomme robux4 at gmail.com
Thu Nov 17 09:36:54 CET 2016


On Thu, Nov 17, 2016 at 8:59 AM, Steve Lhomme <robux4 at videolabs.io> wrote:
> ---
>  src/playlist/tree.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/playlist/tree.c b/src/playlist/tree.c
> index 8bc560f..2839aa1 100644
> --- a/src/playlist/tree.c
> +++ b/src/playlist/tree.c
> @@ -69,7 +69,8 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
>      p_new_input = input_item_NewExt( NULL, psz_name, -1, ITEM_TYPE_NODE,
>                                       ITEM_NET_UNKNOWN );
>      p_item = playlist_ItemNewFromInput( p_playlist, p_new_input );
> -    vlc_gc_decref( p_new_input );
> +    if( p_new_input )
> +        vlc_gc_decref( p_new_input );

The check should be done after the input_item_NewExt() call.
playlist_ItemNewFromInput() will crash if it's NULL.

>      if( p_item == NULL )  return NULL;
>      p_item->i_children = 0;
> --
> 2.10.1
>


More information about the vlc-devel mailing list