headerlist.c: from repodata: fix changelog ordering and a wrong free()

This commit is contained in:
Silvan Calarco 2021-02-19 17:43:54 +01:00
parent 6a5bfecb6d
commit 378aedbdbe

View File

@ -852,13 +852,13 @@ void getXMLPackageChangelog(xmlNode *parent,
*changelogrelease = malloc(sizeof(char*) * *count); *changelogrelease = malloc(sizeof(char*) * *count);
*changelogtext = 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) { for (xmlNode *entry=parent->children; entry; entry=entry->next) {
if (entry->type == XML_ELEMENT_NODE && !strcmp((char*)entry->name, "changelog")) { if (entry->type == XML_ELEMENT_NODE && !strcmp((char*)entry->name, "changelog")) {
(*changelogtime)[i] = atoi((char*)findXMLAttributeByName(entry, "date")); (*changelogtime)[i] = atoi((char*)findXMLAttributeByName(entry, "date"));
(*changelogrelease)[i] = strdup((char*)findXMLAttributeByName(entry, "author")); (*changelogrelease)[i] = strdup((char*)findXMLAttributeByName(entry, "author"));
(*changelogtext)[i] = strdup((char*)entry->children->content); (*changelogtext)[i] = strdup((char*)entry->children->content);
i++; i--;
} }
} }
@ -1847,6 +1847,7 @@ char* advanceXMLPackageNode(xmlNode **primary_node, xmlNode **filelists_node) {
#if RPM_VERSION >= 0x050000 #if RPM_VERSION >= 0x050000
rpmtsFree(ts); rpmtsFree(ts);
#endif #endif
if (!repodata[0])
free(namelist); free(namelist);
createProvidedListIndex((struct providedList **)&(ct->providedlist_idx[arch]), arch); createProvidedListIndex((struct providedList **)&(ct->providedlist_idx[arch]), arch);
return 0; return 0;