Skip to content

Commit

Permalink
[gsi] Fix some memory leaks when using Secgsi
Browse files Browse the repository at this point in the history
  • Loading branch information
smithdh committed Jun 9, 2023
1 parent 2b42eba commit c7175b4
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 78 deletions.
1 change: 1 addition & 0 deletions src/XrdCrypto/XrdCryptosslCipher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ bool XrdCryptosslCipher::Finalize(bool padded,
EVP_PKEY_derive_set_peer(pkctx, peer);
EVP_PKEY_derive(pkctx, (unsigned char *)ktmp, &ltmp);
EVP_PKEY_CTX_free(pkctx);
EVP_PKEY_free(peer);
if (ltmp > 0) {
#if OPENSSL_VERSION_NUMBER < 0x10101000L
if (padded) {
Expand Down
7 changes: 5 additions & 2 deletions src/XrdCrypto/XrdCryptosslRSA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ int XrdCryptosslRSA::ImportPrivate(const char *pri, int lpri)

if (!fEVP)
return -1;

int rc = -1;
prilen = -1;

// Bio for exporting the pub key
Expand All @@ -337,9 +339,10 @@ int XrdCryptosslRSA::ImportPrivate(const char *pri, int lpri)
if (PEM_read_bio_PrivateKey(bpri, &fEVP, 0, 0)) {
// Update status
status = kComplete;
return 0;
rc = 0;
}
return -1;
BIO_free(bpri);
return rc;
}

//_____________________________________________________________________________
Expand Down

0 comments on commit c7175b4

Please sign in to comment.