From 795c71663dcd2f832d0409ee89e1c1bd355c42a1 Mon Sep 17 00:00:00 2001 From: Starg Date: Sat, 28 Apr 2018 17:40:50 +0900 Subject: [PATCH] Fix uninitializing playlist --- interface/w32g_playlist.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/interface/w32g_playlist.c b/interface/w32g_playlist.c index 0c3aa76f..de34ee79 100644 --- a/interface/w32g_playlist.c +++ b/interface/w32g_playlist.c @@ -1404,27 +1404,38 @@ void w32g_free_playlist(void) for(j=0; j < PLAYLIST_MAX; j++){ for(i=0; i < playlist[j].nfiles; i++){ entry = &playlist[j].list[i]; - if(entry->filepath != NULL) free(entry->filepath); + free(entry->filepath); + entry->filepath = NULL; #ifdef LISTVIEW_PLAYLIST - if(entry->duration != NULL) free(entry->duration); - if(entry->filetype != NULL) free(entry->filetype); - if(entry->system != NULL) free(entry->system); + free(entry->duration); + entry->duration = NULL; + free(entry->filetype); + entry->filetype = NULL; + free(entry->system); + entry->system = NULL; #endif } - if(playlist[j].list != NULL) free(playlist[j].list); + free(playlist[j].list); + playlist[j].list = NULL; } - if(playlist_shuffle.list != NULL) free(playlist_shuffle.list); + free(playlist_shuffle.list); + playlist_shuffle.list = NULL; #ifdef LISTVIEW_PLAYLIST // clear tmp_playlist for(i = 0; i < tmp_playlist.nfiles; i++){ entry = &tmp_playlist.list[i]; - if(entry->filepath != NULL) free(entry->filepath); - if(entry->duration != NULL) free(entry->duration); - if(entry->filetype != NULL) free(entry->filetype); - if(entry->system != NULL) free(entry->system); + free(entry->filepath); + entry->filepath = NULL; + free(entry->duration); + entry->duration = NULL; + free(entry->filetype); + entry->filetype = NULL; + free(entry->system); + entry->system = NULL; } - if(tmp_playlist.list != NULL) free(tmp_playlist.list); + free(tmp_playlist.list); + tmp_playlist.list = NULL; #endif } -- 2.11.0