summaryrefslogtreecommitdiffstats
path: root/crypto/objects
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2018-04-26 12:06:17 -0400
committerRich Salz <rsalz@openssl.org>2018-04-26 12:27:46 -0400
commitf06080cb3da93e99755edb5f19e7ccc132aeba36 (patch)
tree5af1d6860ee8f6f8305a77190fa1f3bc4fcc336b /crypto/objects
parentd1f7a1e62a5b67b492f8e7eb48130bf00f9a3ab0 (diff)
Add missing error code when alloc-return-null
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6085)
Diffstat (limited to 'crypto/objects')
-rw-r--r--crypto/objects/obj_dat.c6
-rw-r--r--crypto/objects/obj_err.c1
2 files changed, 5 insertions, 2 deletions
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index fb82f25300..ef2d1e0dda 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -350,7 +350,7 @@ int OBJ_obj2nid(const ASN1_OBJECT *a)
ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
{
int nid = NID_undef;
- ASN1_OBJECT *op = NULL;
+ ASN1_OBJECT *op;
unsigned char *buf;
unsigned char *p;
const unsigned char *cp;
@@ -376,8 +376,10 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
if (j < 0)
return NULL;
- if ((buf = OPENSSL_malloc(j)) == NULL)
+ if ((buf = OPENSSL_malloc(j)) == NULL) {
+ OBJerr(OBJ_F_OBJ_TXT2OBJ, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
p = buf;
/* Write out tag+length */
diff --git a/crypto/objects/obj_err.c b/crypto/objects/obj_err.c
index 9b4779ad4d..be4f11ca20 100644
--- a/crypto/objects/obj_err.c
+++ b/crypto/objects/obj_err.c
@@ -22,6 +22,7 @@ static const ERR_STRING_DATA OBJ_str_functs[] = {
{ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NID2LN, 0), "OBJ_nid2ln"},
{ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NID2OBJ, 0), "OBJ_nid2obj"},
{ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NID2SN, 0), "OBJ_nid2sn"},
+ {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_TXT2OBJ, 0), "OBJ_txt2obj"},
{0, NULL}
};