From: Kristian Høgsberg Date: Thu, 19 Jun 2008 19:09:48 +0000 (-0400) Subject: Handle NULL dirnames when importing rpms into a set. X-Git-Tag: 0.1~125 X-Git-Url: http://project.juiblex.co.uk/git/?a=commitdiff_plain;h=157b904acee4209f6555550768edf1e150046146;p=razor.git Handle NULL dirnames when importing rpms into a set. --- diff --git a/librazor/rpm.c b/librazor/rpm.c index c87de7f..af7c5ae 100644 --- a/librazor/rpm.c +++ b/librazor/rpm.c @@ -322,8 +322,10 @@ import_files(struct razor_importer *importer, struct razor_rpm *rpm) unsigned int i, count; char buffer[256]; - /* assert: count is the same for all arrays */ + if (rpm->dirs == NULL) + return; + /* assert: count is the same for all arrays */ index = razor_rpm_get_indirect(rpm, RPMTAG_DIRINDEXES, &count); name = razor_rpm_get_indirect(rpm, RPMTAG_BASENAMES, &count); for (i = 0; i < count; i++) { @@ -346,6 +348,8 @@ razor_rpm_open(const char *filename) int fd; rpm = malloc(sizeof *rpm); + if (rpm == NULL) + return NULL; memset(rpm, 0, sizeof *rpm); fd = open(filename, O_RDONLY);