[vlc-commits] lib: media_track: Add missing allocation checks

Hugo Beauzée-Luyssen git at videolan.org
Mon Jun 15 09:56:41 CEST 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Jun 12 12:43:09 2020 +0200| [6a693c2730d4047578640bb4cde8d83139757dfa] | committer: Thomas Guillem

lib: media_track: Add missing allocation checks

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a693c2730d4047578640bb4cde8d83139757dfa
---

 lib/media_track.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/media_track.c b/lib/media_track.c
index feca38f7ef..d9cb7932a7 100644
--- a/lib/media_track.c
+++ b/lib/media_track.c
@@ -177,7 +177,7 @@ libvlc_media_tracklist_from_es_array( es_format_t **es_array,
 
     libvlc_media_tracklist_t *list = libvlc_media_tracklist_alloc( count );
 
-    if( count == 0 )
+    if( count == 0 || list == NULL )
         return list;
 
     count = 0;
@@ -232,6 +232,9 @@ libvlc_media_tracklist_from_player( vlc_player_t *player,
     size_t count = vlc_player_GetTrackCount( player, cat );
     libvlc_media_tracklist_t *list = libvlc_media_tracklist_alloc( count );
 
+    if( !list )
+        return NULL;
+
     for( size_t i = 0; i < count; ++i )
     {
         const struct vlc_player_track *track =



More information about the vlc-commits mailing list