summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Orton <joe@manyfish.uk>2021-03-06 17:14:48 +0000
committerJoe Orton <joe@manyfish.uk>2021-03-06 17:14:48 +0000
commit12d9cfcfa50579c0853867aa3209616b8bc9bfa8 (patch)
treeba03718589e64782e0414fd580e4d1f57e104eb6
parent969a8f6d20cf7654e58450149f411fca57d670aa (diff)
downloadneon-git-12d9cfcfa50579c0853867aa3209616b8bc9bfa8.tar.gz
* src/ne_openssl.c (ne_vstrhash): Handle EVP_MD_CTX_new() failing.
Free the context if EVP_DigestInit() fails.
-rw-r--r--src/ne_openssl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ne_openssl.c b/src/ne_openssl.c
index 7901778..b0ed5fa 100644
--- a/src/ne_openssl.c
+++ b/src/ne_openssl.c
@@ -1158,7 +1158,12 @@ char *ne_vstrhash(unsigned int flags, va_list ap)
}
ctx = EVP_MD_CTX_new();
- if (EVP_DigestInit(ctx, md) != 1) return NULL;
+ if (!ctx) return NULL;
+
+ if (EVP_DigestInit(ctx, md) != 1) {
+ EVP_MD_CTX_free(ctx);
+ return NULL;
+ }
while ((arg = va_arg(ap, const char *)) != NULL)
EVP_DigestUpdate(ctx, arg, strlen(arg));