diff options
author | David Benjamin <davidben@chromium.org> | 2015-02-12 08:48:45 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-02-13 21:43:01 +0300 |
commit | c35fb014d9b6dfbb73a08af5d3ccec194ed2ec0c (patch) | |
tree | 9ead9d19241c9c58dee1dfffc079555a0a79c042 /crypto | |
parent | 776597dac7b0e064761ecb775b7d2cbd235dc864 (diff) |
Fix more memory leaks on malloc failure.
Caught by malloc valgrind tests on Basic-Client-Sync. Also one by inspection
and verified with valgrind. Those should pass now with the exception of
CRYPTO_free_ex_data being internally implemented with malloc.
(Clearly we next should make our malloc tests assert that the containing
function fails to catch when we fail to check for some error and things
silently move one.)
Change-Id: I56c51dc8a32a7d3c7ac907d54015dc241728c761
Reviewed-on: https://boringssl-review.googlesource.com/3440
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/tasn_new.c | 1 | ||||
-rw-r--r-- | crypto/ec/ec_montgomery.c | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/crypto/asn1/tasn_new.c b/crypto/asn1/tasn_new.c index b68eed70..e59025bb 100644 --- a/crypto/asn1/tasn_new.c +++ b/crypto/asn1/tasn_new.c @@ -212,6 +212,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, memerr: OPENSSL_PUT_ERROR(ASN1, asn1_item_ex_combine_new, ERR_R_MALLOC_FAILURE); + ASN1_item_ex_free(pval, it); #ifdef CRYPTO_MDEBUG if (it->sname) CRYPTO_pop_info(); #endif diff --git a/crypto/ec/ec_montgomery.c b/crypto/ec/ec_montgomery.c index b1c6fe89..0e5120c7 100644 --- a/crypto/ec/ec_montgomery.c +++ b/crypto/ec/ec_montgomery.c @@ -247,6 +247,9 @@ err: if (mont != NULL) { BN_MONT_CTX_free(mont); } + if (one != NULL) { + BN_free(one); + } return ret; } |