diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2014-01-28 11:56:59 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-01-28 12:01:35 +0100 |
commit | 6a0787a366ea598dff6ae09172b28522456a8606 (patch) | |
tree | 363ad0dc4bc65e551ceb21e360d9c39bbe54b267 | |
parent | 709e921942b810008fd68674a271e2aa5f6cf466 (diff) | |
download | libssh-6a0787a366ea598dff6ae09172b28522456a8606.tar.gz libssh-6a0787a366ea598dff6ae09172b28522456a8606.tar.xz libssh-6a0787a366ea598dff6ae09172b28522456a8606.zip |
pki_crypto: Fix memory leak with EC_KEY_set_public_key().
BUG: https://red.libssh.org/issues/146
-rw-r--r-- | src/pki_crypto.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pki_crypto.c b/src/pki_crypto.c index 435a8934..9a7c3e28 100644 --- a/src/pki_crypto.c +++ b/src/pki_crypto.c @@ -200,9 +200,11 @@ int pki_pubkey_build_ecdsa(ssh_key key, int nid, ssh_string e) return -1; } + /* EC_KEY_set_public_key duplicates p */ ok = EC_KEY_set_public_key(key->ecdsa, p); + EC_POINT_free(p); if (!ok) { - EC_POINT_free(p); + return -1; } return 0; |