diff options
author | Michal Domonkos <mdomonko@redhat.com> | 2021-06-15 13:34:21 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2021-08-20 11:44:09 +0300 |
commit | 5640bda977fcb4d35a24e8a1aeedd08852281746 (patch) | |
tree | 6cb7f86df7f618d899dccec92b5d35576d0a4dcb | |
parent | 4d4890c3c4fcfb026b77fcf92751ec71146575ba (diff) | |
download | rpm-5640bda977fcb4d35a24e8a1aeedd08852281746.tar.gz |
Fix memory leak in decodePkts()
Found by Coverity.
(cherry picked from commit 9c093c4f092dd6bd1e0c8d2b852a72b74db076c2)
-rw-r--r-- | rpmio/rpmpgp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index c59185dce..ee5c81e24 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -1371,9 +1371,13 @@ static pgpArmor decodePkts(uint8_t *b, uint8_t **pkt, size_t *pktlen) crc = pgpCRC(dec, declen); if (crcpkt != crc) { ec = PGPARMOR_ERR_CRC_CHECK; + _free(dec); goto exit; } - if (pkt) *pkt = dec; + if (pkt) + *pkt = dec; + else + _free(dec); if (pktlen) *pktlen = declen; ec = PGPARMOR_PUBKEY; /* XXX ASCII Pubkeys only, please. */ goto exit; |