diff options
author | Richard Levitte <levitte@openssl.org> | 2002-05-30 16:47:45 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2002-05-30 16:47:45 +0000 |
commit | 9cdf87f19431b32a50b12e468cf2a9557cfc3568 (patch) | |
tree | 5aa5e1f88093d6b8013b9e2f1af0b18201b9bef6 /crypto/objects | |
parent | a81e9d3dc45f29c1a5fde7fa641a43f796fe92d4 (diff) |
Check the return values where memory allocation failures may happen.
PR: 49
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/o_names.c | 3 | ||||
-rw-r--r-- | crypto/objects/obj_dat.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 2b80243256..b4453b4a98 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -79,6 +79,8 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), { MemCheck_off(); name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); + MemCheck_on(); + if (!name_funcs) return(0); name_funcs->hash_func = lh_strhash; name_funcs->cmp_func = OPENSSL_strcmp; name_funcs->free_func = 0; /* NULL is often declared to @@ -86,6 +88,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), * to Compaq C is not really * compatible with a function * pointer. -- Richard Levitte*/ + MemCheck_off(); sk_NAME_FUNCS_push(name_funcs_stack,name_funcs); MemCheck_on(); } diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 8779ba7d1d..3ff64bb8d1 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -236,7 +236,7 @@ int OBJ_add_object(const ASN1_OBJECT *obj) if (added == NULL) if (!init_added()) return(0); if ((o=OBJ_dup(obj)) == NULL) goto err; - ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); + if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err; if ((o->length != 0) && (obj->data != NULL)) ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); if (o->sn != NULL) |