From: RĂ©mi Denis-Courmont Date: Wed, 23 Apr 2014 16:41:54 +0000 (+0300) Subject: lib: avoid NULL deref on error X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8c9e80fb1f9c848e61105a304a74c26664383311;p=vlc lib: avoid NULL deref on error --- diff --git a/lib/media.c b/lib/media.c index af70b4a7e2..bac11da057 100644 --- a/lib/media.c +++ b/lib/media.c @@ -113,15 +113,14 @@ static void input_item_subitem_added( const vlc_event_t *p_event, p_event->u.input_item_subitem_added.p_new_child ); /* Add this to our media list */ - if( !p_md->p_subitems ) + if( p_md->p_subitems == NULL ) { p_md->p_subitems = libvlc_media_list_new( p_md->p_libvlc_instance ); + if( unlikely(p_md->p_subitems == NULL) ) + abort(); libvlc_media_list_set_media( p_md->p_subitems, p_md ); } - if( p_md->p_subitems ) - { - libvlc_media_list_add_media( p_md->p_subitems, p_md_child ); - } + libvlc_media_list_add_media( p_md->p_subitems, p_md_child ); /* Construct the event */ event.type = libvlc_MediaSubItemAdded;