Skip to content

Commit

Permalink
Fix memory leaks in rpmGetSubkeys() and pgpPrtParamsSubkeys()
Browse files Browse the repository at this point in the history
  • Loading branch information
Lubos Kardos committed Mar 8, 2016
1 parent 468726e commit cc61141
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions rpmio/rpmkeyring.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ rpmPubkey *rpmGetSubkeys(rpmPubkey mainkey, int *count)
subkey->nrefs = 1;
pthread_rwlock_init(&subkey->lock, NULL);
}
free(pgpsubkeys);
}
*count = pgpsubkeysCount;

Expand Down
4 changes: 3 additions & 1 deletion rpmio/rpmpgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit cc61141

Please sign in to comment.