diff --git a/src/headerlist.c b/src/headerlist.c index 786c1b7..8d36d80 100644 --- a/src/headerlist.c +++ b/src/headerlist.c @@ -852,13 +852,13 @@ void getXMLPackageChangelog(xmlNode *parent, *changelogrelease = malloc(sizeof(char*) * *count); *changelogtext = malloc(sizeof(char*) * *count); - int i = 0; + int i = *count -1; for (xmlNode *entry=parent->children; entry; entry=entry->next) { if (entry->type == XML_ELEMENT_NODE && !strcmp((char*)entry->name, "changelog")) { (*changelogtime)[i] = atoi((char*)findXMLAttributeByName(entry, "date")); (*changelogrelease)[i] = strdup((char*)findXMLAttributeByName(entry, "author")); (*changelogtext)[i] = strdup((char*)entry->children->content); - i++; + i--; } } @@ -1847,7 +1847,8 @@ char* advanceXMLPackageNode(xmlNode **primary_node, xmlNode **filelists_node) { #if RPM_VERSION >= 0x050000 rpmtsFree(ts); #endif - free(namelist); + if (!repodata[0]) + free(namelist); createProvidedListIndex((struct providedList **)&(ct->providedlist_idx[arch]), arch); return 0; }