diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-03-10 11:03:08 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-04-03 14:01:57 +0300 |
commit | 021b3ae3a6af9c0c66ba5b6a5225c678dc944438 (patch) | |
tree | 50c7750cf35911c5cb492ba6713af52e0e549f5f | |
parent | f4da893a5f59fa32110f9eff803dccee1d85c29c (diff) | |
download | rpm-021b3ae3a6af9c0c66ba5b6a5225c678dc944438.tar.gz rpm-021b3ae3a6af9c0c66ba5b6a5225c678dc944438.tar.bz2 rpm-021b3ae3a6af9c0c66ba5b6a5225c678dc944438.zip |
Fix memleak on signature checking failure
- early exit from header iteration loop could previously leak from unfreed
buf and header iterator
(cherry picked from commit 05e16d415492f4925782e3fcf6ef155cbdf124c3)
-rw-r--r-- | lib/rpmchecksig.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 703dee57a..f7bd6dc2f 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -562,7 +562,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, pgpDig dig = NULL; pgpDigParams sigp; Header sigh = NULL; - HeaderIterator hi; + HeaderIterator hi = NULL; char * msg; int res = 0; int xx; @@ -759,7 +759,6 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, free(msg); buf = b; } - hi = headerFreeIterator(hi); res += failed; @@ -775,12 +774,13 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, untrustedKeys ? untrustedKeys : "", untrustedKeys ? _(")") : ""); } - free(buf); free(missingKeys); free(untrustedKeys); exit: + free(buf); sigh = rpmFreeSignature(sigh); + hi = headerFreeIterator(hi); rpmKeyringFree(keyring); pgpFreeDig(dig); return res; |