summaryrefslogtreecommitdiff
path: root/crypto/lhash/lhash.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/lhash/lhash.c')
-rw-r--r--crypto/lhash/lhash.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c
index 38c084d115..116274b024 100644
--- a/crypto/lhash/lhash.c
+++ b/crypto/lhash/lhash.c
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <openssl/crypto.h>
#include <openssl/lhash.h>
+#include <openssl/err.h>
#include "lhash_lcl.h"
/*
@@ -45,8 +46,14 @@ OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c)
{
OPENSSL_LHASH *ret;
- if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
+ if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
+ /*
+ * Do not set the error code, because the ERR code uses LHASH
+ * and we want to avoid possible endless error loop.
+ * CRYPTOerr(CRYPTO_F_OPENSSL_LH_NEW, ERR_R_MALLOC_FAILURE);
+ */
return NULL;
+ }
if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
goto err;
ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);