remove malloc casts

Following ANSI C rules, remove the casts from calls to
OPENSSL_malloc and OPENSSL_realloc.

Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Rich Salz
2015-04-28 15:28:14 -04:00
parent 3e47caff48
commit b196e7d936
114 changed files with 191 additions and 226 deletions

View File

@@ -255,21 +255,19 @@ int OBJ_add_object(const ASN1_OBJECT *obj)
return (0);
if ((o = OBJ_dup(obj)) == NULL)
goto err;
if (!(ao[ADDED_NID] = (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
if (!(ao[ADDED_NID] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
if ((o->length != 0) && (obj->data != NULL))
if (!
(ao[ADDED_DATA] = (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
(ao[ADDED_DATA] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
if (o->sn != NULL)
if (!
(ao[ADDED_SNAME] =
(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
(ao[ADDED_SNAME] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
if (o->ln != NULL)
if (!
(ao[ADDED_LNAME] =
(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
(ao[ADDED_LNAME] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
for (i = ADDED_DATA; i <= ADDED_NID; i++) {
@@ -450,7 +448,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
/* Work out total size */
j = ASN1_object_size(0, i, V_ASN1_OBJECT);
if ((buf = (unsigned char *)OPENSSL_malloc(j)) == NULL)
if ((buf = OPENSSL_malloc(j)) == NULL)
return NULL;
p = buf;
@@ -766,7 +764,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln)
if (i <= 0)
return (0);
if ((buf = (unsigned char *)OPENSSL_malloc(i)) == NULL) {
if ((buf = OPENSSL_malloc(i)) == NULL) {
OBJerr(OBJ_F_OBJ_CREATE, ERR_R_MALLOC_FAILURE);
return (0);
}