From b01e650546075f574068d89eb58101a88a8f5ed2 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 31 Jul 2010 18:12:48 +0200 Subject: Fix genre station NULL pointer dereference Obviously pandora changed the genre station api. Attention: Incompatible libpiano abi change. --- libpiano/src/xml.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'libpiano/src/xml.c') diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c index 33fe557..78f7f21 100644 --- a/libpiano/src/xml.c +++ b/libpiano/src/xml.c @@ -745,27 +745,27 @@ PianoReturn_t PianoXmlParseGenreExplorer (PianoHandle_t *ph, char *xml) { /* get genre subnodes */ for (genreNode = ezxml_child (catNode, "genre"); genreNode; genreNode = genreNode->next) { - PianoStation_t *tmpStation; + PianoGenre_t *tmpGenre; - if ((tmpStation = calloc (1, sizeof (*tmpStation))) == NULL) { + if ((tmpGenre = calloc (1, sizeof (*tmpGenre))) == NULL) { ezxml_free (xmlDoc); return PIANO_RET_OUT_OF_MEMORY; } /* get genre attributes */ - tmpStation->name = strdup (ezxml_attr (genreNode, "name")); - tmpStation->id = strdup (ezxml_attr (genreNode, "stationId")); + tmpGenre->name = strdup (ezxml_attr (genreNode, "name")); + tmpGenre->musicId = strdup (ezxml_attr (genreNode, "musicId")); /* append station */ - if (tmpGenreCategory->stations == NULL) { - tmpGenreCategory->stations = tmpStation; + if (tmpGenreCategory->genres == NULL) { + tmpGenreCategory->genres = tmpGenre; } else { - PianoStation_t *curStation = - tmpGenreCategory->stations; - while (curStation->next != NULL) { - curStation = curStation->next; + PianoGenre_t *curGenre = + tmpGenreCategory->genres; + while (curGenre->next != NULL) { + curGenre = curGenre->next; } - curStation->next = tmpStation; + curGenre->next = tmpGenre; } } /* append category */ -- cgit v1.2.3