diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-01-28 17:07:42 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-01-28 17:07:42 +0200 |
commit | 06a2f1269b035a3a76464149834f2a5a8c4e89f2 (patch) | |
tree | d5d11a7900d974196484e2ad984321a8e6d47298 /lib/verify.c | |
parent | 5e4fb2589ca19b7844f420affe9977c04a124469 (diff) | |
download | rpm-06a2f1269b035a3a76464149834f2a5a8c4e89f2.tar.gz |
Don't assume rpmfiNew() always succeeds
- Add NULL checks and add/adjust comments where appropriate.
- The remaining callers should handle NULL fi gracefully if not
entirely correctly: rpmfiFC() returns 0 on NULL fi, so these
callers just see the erronous file info set as "no files" case.
Something to fine-tune later...
Diffstat (limited to 'lib/verify.c')
-rw-r--r-- | lib/verify.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/verify.c b/lib/verify.c index 21289d163..35612fe4b 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -339,6 +339,9 @@ static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask, int ghosts) int ec = 0; /* assume no problems */ rpmfi fi = rpmfiNew(ts, h, RPMTAG_BASENAMES, RPMFI_FLAGS_VERIFY); + if (fi == NULL) + return 1; + rpmfiInit(fi, 0); while (rpmfiNext(fi) >= 0) { rpmfileAttrs fileAttrs = rpmfiFFlags(fi); |