diff options
author | Jonas Maebe <jonas.maebe@elis.ugent.be> | 2013-12-08 22:45:58 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2014-08-17 18:55:01 +0200 |
commit | 254f1c8019f4c2aa853208604f703deb8adfe131 (patch) | |
tree | 541d718f7281144af59b173e689d69398d3cf80e /crypto/x509 | |
parent | fb7fbf28b3d42e67d1611c10eed53bafed93c898 (diff) |
get_cert_by_subject: check for NULL when allocating hent
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/by_dir.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index c6602dae4f..8f3560a232 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -444,6 +444,13 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, if (!hent) { hent = OPENSSL_malloc(sizeof(BY_DIR_HASH)); + if (hent == NULL) + { + CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); + X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_MALLOC_FAILURE); + ok = 0; + goto finish; + } hent->hash = h; hent->suffix = k; if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) |