1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

pki_crypto: Fix memory leak with EC_KEY_set_public_key().

BUG: https://red.libssh.org/issues/146
This commit is contained in:
Andreas Schneider
2014-01-28 11:56:59 +01:00
parent 3224506fe0
commit 75be42df75

View File

@@ -200,9 +200,11 @@ int pki_pubkey_build_ecdsa(ssh_key key, int nid, ssh_string e)
return -1; return -1;
} }
/* EC_KEY_set_public_key duplicates p */
ok = EC_KEY_set_public_key(key->ecdsa, p); ok = EC_KEY_set_public_key(key->ecdsa, p);
EC_POINT_free(p);
if (!ok) { if (!ok) {
EC_POINT_free(p); return -1;
} }
return 0; return 0;