[vlc-commits] preparser: art: add missing alloc check

Thomas Guillem git at videolan.org
Mon Aug 26 09:29:42 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Aug 22 10:54:34 2019 +0200| [2949b6580193a162cbcd536927e828d7fa3a7847] | committer: Thomas Guillem

preparser: art: add missing alloc check

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

 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,



More information about the vlc-commits mailing list