diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-04 17:49:51 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-05 09:09:57 +0000 |
commit | 918bb8652969fd53f0c390c1cd909265ed502c7e (patch) | |
tree | 883afa725e4529a992611b5b02e8b5c784463e99 /crypto/dh/dh_pmeth.c | |
parent | 618be04e407a7800a7198ac87fa5e8cee7c6e10b (diff) |
Unchecked malloc fixes
Miscellaneous unchecked malloc fixes. Also fixed some mem leaks on error
paths as I spotted them along the way.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/dh/dh_pmeth.c')
-rw-r--r-- | crypto/dh/dh_pmeth.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c index c41de925c7..8975f4492a 100644 --- a/crypto/dh/dh_pmeth.c +++ b/crypto/dh/dh_pmeth.c @@ -468,6 +468,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, ret = 0; Zlen = DH_size(dh); Z = OPENSSL_malloc(Zlen); + if(!Z) { + goto err; + } if (DH_compute_key_padded(Z, dhpub, dh) <= 0) goto err; if (!DH_KDF_X9_42(key, *keylen, Z, Zlen, dctx->kdf_oid, |