Align d2i_ECPrivateKey error-handling with upstream.
Upstream decided to make the caller free the scratch space rather than the callee. May as well match. (Existing code is pretty inconsistent. This API pattern needs to go.) See upstream's 9e442d485008046933cdc7da65080f436a4af089. Change-Id: I7c9fcae5778a74d6ae8e9f546e03fb2cf6e48426 Reviewed-on: https://boringssl-review.googlesource.com/3671 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
committed by
Adam Langley
parent
114ddebbf6
commit
29b50eab6c
+4
-7
@@ -309,9 +309,6 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const uint8_t **in, long len) {
|
||||
OPENSSL_PUT_ERROR(EC, d2i_ECPrivateKey, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
if (a) {
|
||||
*a = ret;
|
||||
}
|
||||
} else {
|
||||
ret = *a;
|
||||
}
|
||||
@@ -380,17 +377,17 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const uint8_t **in, long len) {
|
||||
ret->enc_flag |= EC_PKEY_NO_PUBKEY;
|
||||
}
|
||||
|
||||
if (a) {
|
||||
*a = ret;
|
||||
}
|
||||
ok = 1;
|
||||
|
||||
err:
|
||||
if (!ok) {
|
||||
if (ret) {
|
||||
if (ret && (a == NULL || *a != ret)) {
|
||||
EC_KEY_free(ret);
|
||||
}
|
||||
ret = NULL;
|
||||
if (a) {
|
||||
*a = ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (priv_key) {
|
||||
|
||||
Reference in New Issue
Block a user