Fix NULL-return checks in 1.0.2
[openssl.git] / crypto / x509 / by_dir.c
index 9ee8f8d8597aa56d5a9c3d8b5f592faea0f3fdfd..bbc3189381e55ebbe5b5fe735b463d33db948ff2 100644 (file)
@@ -401,6 +401,10 @@ 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) {
+                    X509err(X509_F_GET_CERT_BY_SUBJECT, ERR_R_MALLOC_FAILURE);
+                    goto finish;
+                }
                 hent->hash = h;
                 hent->suffix = k;
                 if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) {