Fix memory leaks in rpmGetSubkeys() and pgpPrtParamsSubkeys()

This commit is contained in:
Lubos Kardos 2016-03-08 14:29:24 +01:00
parent 468726ece5
commit cc61141245
2 changed files with 4 additions and 1 deletions

View File

@ -177,6 +177,7 @@ rpmPubkey *rpmGetSubkeys(rpmPubkey mainkey, int *count)
subkey->nrefs = 1;
pthread_rwlock_init(&subkey->lock, NULL);
}
free(pgpsubkeys);
}
*count = pgpsubkeysCount;

View File

@ -1022,8 +1022,10 @@ int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen,
/* Copy UID from main key to subkey */
digps[count]->userid = xstrdup(mainkey->userid);
if(getFingerprint(pkt.body, pkt.blen, digps[count]->signid))
if(getFingerprint(pkt.body, pkt.blen, digps[count]->signid)) {
pgpDigParamsFree(digps[count]);
continue;
}
if(pgpPrtKey(pkt.tag, pkt.body, pkt.blen, digps[count])) {
pgpDigParamsFree(digps[count]);