summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-05-17 15:08:43 +0100
committerMatt Caswell <matt@openssl.org>2016-05-18 10:47:15 +0100
commit569d0646096e6c7e07b9b89b04204eef934c3b69 (patch)
tree8e649d1b033ec73cb6134123aa0024daf2394387 /crypto/dh
parent6ef020c988bb508842dfcd517a4b41cae214f641 (diff)
Add some error messages for malloc fails
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_err.c3
-rw-r--r--crypto/dh/dh_meth.c7
2 files changed, 9 insertions, 1 deletions
diff --git a/crypto/dh/dh_err.c b/crypto/dh/dh_err.c
index a1bada9e98..e1e5b49ee0 100644
--- a/crypto/dh/dh_err.c
+++ b/crypto/dh/dh_err.c
@@ -30,6 +30,9 @@ static ERR_STRING_DATA DH_str_functs[] = {
{ERR_FUNC(DH_F_DH_CMS_DECRYPT), "dh_cms_decrypt"},
{ERR_FUNC(DH_F_DH_CMS_SET_PEERKEY), "dh_cms_set_peerkey"},
{ERR_FUNC(DH_F_DH_CMS_SET_SHARED_INFO), "dh_cms_set_shared_info"},
+ {ERR_FUNC(DH_F_DH_METH_DUP), "DH_meth_dup"},
+ {ERR_FUNC(DH_F_DH_METH_NEW), "DH_meth_new"},
+ {ERR_FUNC(DH_F_DH_METH_SET1_NAME), "DH_meth_set1_name"},
{ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"},
{ERR_FUNC(DH_F_DH_PARAM_DECODE), "dh_param_decode"},
{ERR_FUNC(DH_F_DH_PRIV_DECODE), "dh_priv_decode"},
diff --git a/crypto/dh/dh_meth.c b/crypto/dh/dh_meth.c
index dbc03143fb..afd47aba8a 100644
--- a/crypto/dh/dh_meth.c
+++ b/crypto/dh/dh_meth.c
@@ -9,6 +9,7 @@
#include "dh_locl.h"
#include <string.h>
+#include <openssl/err.h>
DH_METHOD *DH_meth_new(const char *name, int flags)
{
@@ -18,6 +19,7 @@ DH_METHOD *DH_meth_new(const char *name, int flags)
dhm->name = OPENSSL_strdup(name);
if (dhm->name == NULL) {
OPENSSL_free(dhm);
+ DHerr(DH_F_DH_METH_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
dhm->flags = flags;
@@ -46,6 +48,7 @@ DH_METHOD *DH_meth_dup(const DH_METHOD *dhm)
ret->name = OPENSSL_strdup(dhm->name);
if (ret->name == NULL) {
OPENSSL_free(ret);
+ DHerr(DH_F_DH_METH_DUP, ERR_R_MALLOC_FAILURE);
return NULL;
}
}
@@ -63,8 +66,10 @@ int DH_meth_set1_name(DH_METHOD *dhm, const char *name)
char *tmpname;
tmpname = OPENSSL_strdup(name);
- if (tmpname == NULL)
+ if (tmpname == NULL) {
+ DHerr(DH_F_DH_METH_SET1_NAME, ERR_R_MALLOC_FAILURE);
return 0;
+ }
OPENSSL_free(dhm->name);
dhm->name = tmpname;