ecdh & ecdsa: avoid some possible memory leaks in error conditions.

This commit is contained in:
Sven-Haegar Koch 2012-04-14 02:28:43 +02:00 committed by Guus Sliepen
parent 8792b9a9f3
commit f8e15dfe8d
2 changed files with 17 additions and 1 deletions

View file

@ -30,7 +30,11 @@
//
bool ecdsa_set_base64_public_key(ecdsa_t *ecdsa, const char *p) {
*ecdsa = EC_KEY_new_by_curve_name(NID_secp521r1);
if(!*ecdsa) {
logger(DEBUG_ALWAYS, LOG_DEBUG, "EC_KEY_new_by_curve_name failed: %s", ERR_error_string(ERR_get_error(), NULL));
return false;
}
int len = strlen(p);
unsigned char pubkey[len / 4 * 3 + 3];
const unsigned char *ppubkey = pubkey;