From 5ae21bc02b9d93e6f33cb94c4b21ebb338803ac9 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 26 Feb 2015 16:26:38 -0500 Subject: [PATCH] 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 --- crypto/ec/ec_asn1.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index 5b3e048f..ab523897 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -290,16 +290,9 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const uint8_t **in, long len) { EC_KEY *ret = NULL; EC_PRIVATEKEY *priv_key = NULL; - priv_key = EC_PRIVATEKEY_new(); - 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); + priv_key = d2i_EC_PRIVATEKEY(NULL, in, len); if (priv_key == NULL) { OPENSSL_PUT_ERROR(EC, d2i_ECPrivateKey, ERR_R_EC_LIB); - EC_PRIVATEKEY_free(priv_key); return NULL; }