diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-07-31 18:12:48 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-07-31 18:12:48 +0200 |
commit | b01e650546075f574068d89eb58101a88a8f5ed2 (patch) | |
tree | 1150b7ea5d147315e07efa4eae9bfd8fed500d58 /libpiano/src/piano.c | |
parent | 1dac515822e85646c2539d2c6261a9c55b6802ab (diff) | |
download | pianobar-windows-b01e650546075f574068d89eb58101a88a8f5ed2.tar.gz pianobar-windows-b01e650546075f574068d89eb58101a88a8f5ed2.tar.bz2 pianobar-windows-b01e650546075f574068d89eb58101a88a8f5ed2.zip |
Fix genre station NULL pointer dereference
Obviously pandora changed the genre station api. Attention: Incompatible
libpiano abi change.
Diffstat (limited to 'libpiano/src/piano.c')
-rw-r--r-- | libpiano/src/piano.c | 17 |
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; |