Commit 64b25758 authored by Rich Salz's avatar Rich Salz Committed by Rich Salz
Browse files

remove 0 assignments.



After openssl_zalloc, cleanup more "set to 0/NULL" assignments.
Many are from github feedback.

Reviewed-by: default avatarTim Hudson <tjh@openssl.org>
parent fb4844bb
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -991,14 +991,7 @@ static int ssl_excert_prepend(SSL_EXCERT **pexc)
{
    SSL_EXCERT *exc = app_malloc(sizeof(*exc), "prepend cert");

    exc->certfile = NULL;
    exc->keyfile = NULL;
    exc->chainfile = NULL;
    exc->cert = NULL;
    exc->key = NULL;
    exc->chain = NULL;
    exc->prev = NULL;
    exc->build_chain = 0;
    memset(exc, 0, sizeof(*exc));

    exc->next = *pexc;
    *pexc = exc;
+1 −6
Original line number Diff line number Diff line
@@ -345,16 +345,11 @@ ASN1_OBJECT *ASN1_OBJECT_new(void)
{
    ASN1_OBJECT *ret;

    ret = OPENSSL_malloc(sizeof(*ret));
    ret = OPENSSL_zalloc(sizeof(*ret));
    if (ret == NULL) {
        ASN1err(ASN1_F_ASN1_OBJECT_NEW, ERR_R_MALLOC_FAILURE);
        return (NULL);
    }
    ret->length = 0;
    ret->data = NULL;
    ret->nid = 0;
    ret->sn = NULL;
    ret->ln = NULL;
    ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
    return (ret);
}
+2 −33
Original line number Diff line number Diff line
@@ -296,48 +296,17 @@ EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
        ameth->info = BUF_strdup(info);
        if (!ameth->info)
            goto err;
    } else
        ameth->info = NULL;
    }

    if (pem_str) {
        ameth->pem_str = BUF_strdup(pem_str);
        if (!ameth->pem_str)
            goto err;
    } else
        ameth->pem_str = NULL;

    ameth->pub_decode = 0;
    ameth->pub_encode = 0;
    ameth->pub_cmp = 0;
    ameth->pub_print = 0;

    ameth->priv_decode = 0;
    ameth->priv_encode = 0;
    ameth->priv_print = 0;

    ameth->old_priv_encode = 0;
    ameth->old_priv_decode = 0;

    ameth->item_verify = 0;
    ameth->item_sign = 0;

    ameth->pkey_size = 0;
    ameth->pkey_bits = 0;

    ameth->param_decode = 0;
    ameth->param_encode = 0;
    ameth->param_missing = 0;
    ameth->param_copy = 0;
    ameth->param_cmp = 0;
    ameth->param_print = 0;

    ameth->pkey_free = 0;
    ameth->pkey_ctrl = 0;
    }

    return ameth;

 err:

    EVP_PKEY_asn1_free(ameth);
    return NULL;

+1 −4
Original line number Diff line number Diff line
@@ -348,15 +348,12 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
{
    ASN1_STRING *ret;

    ret = OPENSSL_malloc(sizeof(*ret));
    ret = OPENSSL_zalloc(sizeof(*ret));
    if (ret == NULL) {
        ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
        return (NULL);
    }
    ret->length = 0;
    ret->type = type;
    ret->data = NULL;
    ret->flags = 0;
    return (ret);
}

+2 −6
Original line number Diff line number Diff line
@@ -85,16 +85,12 @@ ASN1_PCTX default_pctx = {
ASN1_PCTX *ASN1_PCTX_new(void)
{
    ASN1_PCTX *ret;
    ret = OPENSSL_malloc(sizeof(*ret));

    ret = OPENSSL_zalloc(sizeof(*ret));
    if (ret == NULL) {
        ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE);
        return NULL;
    }
    ret->flags = 0;
    ret->nm_flags = 0;
    ret->cert_flags = 0;
    ret->oid_flags = 0;
    ret->str_flags = 0;
    return ret;
}

Loading