aboutsummaryrefslogtreecommitdiff
path: root/crypto/comp/comp_lib.c
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2025-05-07 21:18:24 +0000
committerEnji Cooper <ngie@FreeBSD.org>2025-05-07 22:37:22 +0000
commit29536654cc41bf41b92dc836c47496dc6fe0b00c (patch)
tree368a3c5b14e610bb5f6b71657f61a41e373eaf97 /crypto/comp/comp_lib.c
parent1c34280346af8284acdc0eae39496811d37df25d (diff)
Diffstat (limited to 'crypto/comp/comp_lib.c')
-rw-r--r--crypto/comp/comp_lib.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/comp/comp_lib.c b/crypto/comp/comp_lib.c
index bf9069d871a4..56ca17a7a54a 100644
--- a/crypto/comp/comp_lib.c
+++ b/crypto/comp/comp_lib.c
@@ -19,10 +19,11 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
{
COMP_CTX *ret;
- if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
- ERR_raise(ERR_LIB_COMP, ERR_R_MALLOC_FAILURE);
+ if (meth == NULL)
+ return NULL;
+
+ if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
return NULL;
- }
ret->meth = meth;
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
OPENSSL_free(ret);
@@ -38,11 +39,15 @@ const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx)
int COMP_get_type(const COMP_METHOD *meth)
{
+ if (meth == NULL)
+ return NID_undef;
return meth->type;
}
const char *COMP_get_name(const COMP_METHOD *meth)
{
+ if (meth == NULL)
+ return NULL;
return meth->name;
}