From 157b904acee4209f6555550768edf1e150046146 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 19 Jun 2008 15:09:48 -0400 Subject: [PATCH] Handle NULL dirnames when importing rpms into a set. --- librazor/rpm.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) 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); -- 1.7.1