headerlist.c: getXMLPackageNFV: fix extending data structures with multiple rich requirements

This commit is contained in:
Silvan Calarco 2021-04-18 13:49:23 +02:00
parent c7eb144bb1
commit f5e33d9f50
2 changed files with 6 additions and 3 deletions

View File

@ -33,6 +33,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>
#include <assert.h>
#if HAVE_UNISTD_H #if HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
@ -458,6 +459,8 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
} }
// currheader->require.resolved = malloc(sizeof(struct providedList*)*currheader->requirecount); // currheader->require.resolved = malloc(sizeof(struct providedList*)*currheader->requirecount);
for (i = 0; i < currheader->requirecount; i++) { for (i = 0; i < currheader->requirecount; i++) {
assert(currheader->require[i] != NULL);
assert(currheader->require[i]->name != NULL);
if (!strncmp("executable(",currheader->require[i]->name,11)) { if (!strncmp("executable(",currheader->require[i]->name,11)) {
/* dynamic requirement for executable file */ /* dynamic requirement for executable file */
/*fprintf(stderr,"Warning: skipping unhandled requirement %s for package %s\n", /*fprintf(stderr,"Warning: skipping unhandled requirement %s for package %s\n",

View File

@ -924,9 +924,9 @@ void getXMLPackageNFV(xmlNode *parent, char ***name,
char **newname = malloc(sizeof(char*) * *count); char **newname = malloc(sizeof(char*) * *count);
uint_32 *newflags = malloc(sizeof(uint_32) * *count); uint_32 *newflags = malloc(sizeof(uint_32) * *count);
char **newversion = malloc(sizeof(char*) * *count); char **newversion = malloc(sizeof(char*) * *count);
memcpy(newname, *name, sizeof(name)); memcpy(newname, *name, sizeof(char*) * (*count -1));
memcpy(newflags, *flags, sizeof(flags)); memcpy(newflags, *flags, sizeof(uint_32) * (*count - 1));
memcpy(newversion, *version, sizeof(version)); memcpy(newversion, *version, sizeof(char*) * (*count - 1));
free(*name); free(*name);
free(*flags); free(*flags);
free(*version); free(*version);