[vlc-devel] [PATCH 1/2] preparser: art: add missing alloc check

Thomas Guillem thomas at gllm.fr
Thu Aug 22 11:51:03 CEST 2019


---
 src/preparser/art.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/preparser/art.c b/src/preparser/art.c
index c6a416b9b3..ad4b677d52 100644
--- a/src/preparser/art.c
+++ b/src/preparser/art.c
@@ -66,8 +66,20 @@ static char* ArtCacheGetDirPath( const char *psz_arturl, const char *psz_artist,
     if( !EMPTY_STR(psz_artist) && !EMPTY_STR(psz_album) )
     {
         char *psz_album_sanitized = strdup( psz_album );
+        if (!psz_album_sanitized)
+        {
+            free( psz_cachedir );
+            return NULL;
+        }
         filename_sanitize( psz_album_sanitized );
+
         char *psz_artist_sanitized = strdup( psz_artist );
+        if (!psz_artist_sanitized)
+        {
+            free( psz_cachedir );
+            free( psz_album_sanitized );
+            return NULL;
+        }
         filename_sanitize( psz_artist_sanitized );
         if( asprintf( &psz_dir, "%s" DIR_SEP "art" DIR_SEP "artistalbum"
                       DIR_SEP "%s" DIR_SEP "%s", psz_cachedir,
-- 
2.20.1



More information about the vlc-devel mailing list