diff options
author | Michal Domonkos <mdomonko@redhat.com> | 2022-01-07 16:10:26 +0100 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2022-01-10 13:20:56 +0200 |
commit | b6dffb6dc5ffa2ddc389743f0507876cab341315 (patch) | |
tree | 1f5383eccf4af7f8c535bab2184f5b8bdf1160a7 /rpmio/rpmpgp.c | |
parent | f0c158cbc8a50a776b44de2c0fe744c451155a41 (diff) | |
download | rpm-b6dffb6dc5ffa2ddc389743f0507876cab341315.tar.gz |
Fix memory leak in pgpPrtParams()
Make sure selfsig is freed in case we break out of the loop in this
block.
Note that the tests added with the binding validation commit bd36c5d do
not cover this code path so valgrind won't show this.
Diffstat (limited to 'rpmio/rpmpgp.c')
-rw-r--r-- | rpmio/rpmpgp.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index 1e4f66782..35603286f 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -1147,12 +1147,11 @@ int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, if (selfsig) { /* subkeys must be followed by binding signature */ - if (prevtag == PGPTAG_PUBLIC_SUBKEY) { - if (selfsig->sigtype != PGPSIGTYPE_SUBKEY_BINDING) - break; - } + int xx = 1; /* assume failure */ - int xx = pgpVerifySelf(digp, selfsig, all, i); + if (!(prevtag == PGPTAG_PUBLIC_SUBKEY && + selfsig->sigtype != PGPSIGTYPE_SUBKEY_BINDING)) + xx = pgpVerifySelf(digp, selfsig, all, i); selfsig = pgpDigParamsFree(selfsig); if (xx) |