summaryrefslogtreecommitdiff
path: root/libpiano/src/piano.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpiano/src/piano.c')
-rw-r--r--libpiano/src/piano.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libpiano/src/piano.c b/libpiano/src/piano.c
index d8b40de..8682cda 100644
--- a/libpiano/src/piano.c
+++ b/libpiano/src/piano.c
@@ -150,6 +150,21 @@ void PianoDestroyPlaylist (PianoSong_t *playlist) {
}
}
+/* destroy genre linked list
+ */
+void PianoDestroyGenres (PianoGenre_t *genres) {
+ PianoGenre_t *curGenre, *lastGenre;
+
+ curGenre = genres;
+ while (curGenre != NULL) {
+ PianoFree (curGenre->name, 0);
+ PianoFree (curGenre->musicId, 0);
+ lastGenre = curGenre;
+ curGenre = curGenre->next;
+ PianoFree (lastGenre, sizeof (*lastGenre));
+ }
+}
+
/* frees the whole piano handle structure
* @param piano handle
* @return nothing
@@ -163,7 +178,7 @@ void PianoDestroy (PianoHandle_t *ph) {
/* destroy genre stations */
PianoGenreCategory_t *curGenreCat = ph->genreStations, *lastGenreCat;
while (curGenreCat != NULL) {
- PianoDestroyStations (curGenreCat->stations);
+ PianoDestroyGenres (curGenreCat->genres);
PianoFree (curGenreCat->name, 0);
lastGenreCat = curGenreCat;
curGenreCat = curGenreCat->next;