aboutsummaryrefslogtreecommitdiff
path: root/crypto/comp/comp_lib.c
diff options
context:
space:
mode:
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;
}