[vlc-devel] [PATCH] lib: media_track: Add missing allocation checks
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Jun 12 12:43:09 CEST 2020
---
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 =
--
2.20.1
More information about the vlc-devel
mailing list