Remove pointless free, and use preferred way of calling d2i_* functions

(Imported from upstream's 535bc8faf69dc4ff39e2ee99195b268cf99b9569)

Change-Id: Ia5abf4dce9dc8cdf5a9b77a3e360a40b5f815adf
Reviewed-on: https://boringssl-review.googlesource.com/3672
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-02-26 16:26:38 -05:00 committed by Adam Langley
parent 29b50eab6c
commit 5ae21bc02b

View File

@ -290,16 +290,9 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const uint8_t **in, long len) {
EC_KEY *ret = NULL; EC_KEY *ret = NULL;
EC_PRIVATEKEY *priv_key = NULL; EC_PRIVATEKEY *priv_key = NULL;
priv_key = EC_PRIVATEKEY_new(); priv_key = d2i_EC_PRIVATEKEY(NULL, in, len);
if (priv_key == NULL) {
OPENSSL_PUT_ERROR(EC, d2i_ECPrivateKey, ERR_R_MALLOC_FAILURE);
return NULL;
}
priv_key = d2i_EC_PRIVATEKEY(&priv_key, in, len);
if (priv_key == NULL) { if (priv_key == NULL) {
OPENSSL_PUT_ERROR(EC, d2i_ECPrivateKey, ERR_R_EC_LIB); OPENSSL_PUT_ERROR(EC, d2i_ECPrivateKey, ERR_R_EC_LIB);
EC_PRIVATEKEY_free(priv_key);
return NULL; return NULL;
} }