From 7c0cea411a1f8889c58b1a0ed59b3a9984c1fbfe Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 23 May 2008 13:46:21 +0300 Subject: [PATCH] Don't crash on package without RPMTAG_OS - damn pubkey "packages" --- lib/rpmte.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/rpmte.c b/lib/rpmte.c index e397c74..2212405 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -79,7 +79,7 @@ static void addTE(rpmts ts, rpmte p, Header h, { int scareMem = 0; rpmte savep; - const char *name, *version, *release, *arch; + const char *name, *version, *release, *arch, *os; struct rpmtd_s td; name = version = release = arch = NULL; @@ -97,7 +97,8 @@ static void addTE(rpmts ts, rpmte p, Header h, p->archScore = arch ? rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch) : 0; headerGet(h, RPMTAG_OS, &td, HEADERGET_MINMEM); - p->os = xstrdup(rpmtdGetString(&td)); + os = rpmtdGetString(&td); + p->os = os ? xstrdup(os) : NULL; p->osScore = p->os ? rpmMachineScore(RPM_MACHTABLE_INSTOS, p->os) : 0; p->isSource = headerIsSource(h); -- 2.7.4