diff --git a/modules/access/cdda.c b/modules/access/cdda.c index 1e69cae2dc85b9a8cae5c92aac4ec9b2f9cad61f..b53e9564e562e33a84f415f132f8bf5c8611f3f9 100644 --- a/modules/access/cdda.c +++ b/modules/access/cdda.c @@ -551,13 +551,15 @@ static cddb_disc_t *GetCDDBInfo( vlc_object_t *obj, const vcddev_toc_t *p_toc ) char *psz_cachedir; char *psz_temp = config_GetUserDir( VLC_CACHE_DIR ); - - if( asprintf( &psz_cachedir, "%s" DIR_SEP "cddb", psz_temp ) > 0 ) { - cddb_cache_enable( p_cddb ); - cddb_cache_set_dir( p_cddb, psz_cachedir ); - free( psz_cachedir ); + if (likely(psz_temp != NULL)) + { + if( asprintf( &psz_cachedir, "%s" DIR_SEP "cddb", psz_temp ) > 0 ) { + cddb_cache_enable( p_cddb ); + cddb_cache_set_dir( p_cddb, psz_cachedir ); + free( psz_cachedir ); + } + free( psz_temp ); } - free( psz_temp ); cddb_set_timeout( p_cddb, 10 );