Commit 75ebbd9a authored by Rich Salz's avatar Rich Salz Committed by Rich Salz
Browse files

Use p==NULL not !p (in if statements, mainly)



Reviewed-by: default avatarTim Hudson <tjh@openssl.org>
parent 344c271e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -502,11 +502,12 @@ int add_oid_section(CONF *conf)
    STACK_OF(CONF_VALUE) *sktmp;
    CONF_VALUE *cnf;
    int i;
    if (!(p = NCONF_get_string(conf, NULL, "oid_section"))) {

    if ((p = NCONF_get_string(conf, NULL, "oid_section")) == NULL) {
        ERR_clear_error();
        return 1;
    }
    if (!(sktmp = NCONF_get_section(conf, p))) {
    if ((sktmp = NCONF_get_section(conf, p)) == NULL) {
        BIO_printf(bio_err, "problem loading oid section %s\n", p);
        return 0;
    }
+1 −1
Original line number Diff line number Diff line
@@ -1703,7 +1703,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
         * Its best to dup the subject DN and then delete any email addresses
         * because this retains its structure.
         */
        if (!(dn_subject = X509_NAME_dup(subject))) {
        if ((dn_subject = X509_NAME_dup(subject)) == NULL) {
            BIO_printf(bio_err, "Memory allocation failure\n");
            goto end;
        }
+11 −11
Original line number Diff line number Diff line
@@ -717,8 +717,8 @@ int cms_main(int argc, char **argv)
            if ((encerts = sk_X509_new_null()) == NULL)
                goto end;
        while (*argv) {
            if (!(cert = load_cert(*argv, FORMAT_PEM,
                                   NULL, e, "recipient certificate file")))
            if ((cert = load_cert(*argv, FORMAT_PEM, NULL, e,
                                  "recipient certificate file")) == NULL)
                goto end;
            sk_X509_push(encerts, cert);
            cert = NULL;
@@ -727,24 +727,24 @@ int cms_main(int argc, char **argv)
    }

    if (certfile) {
        if (!(other = load_certs(certfile, FORMAT_PEM, NULL,
                                 e, "certificate file"))) {
        if ((other = load_certs(certfile, FORMAT_PEM, NULL, e,
                                "certificate file")) == NULL) {
            ERR_print_errors(bio_err);
            goto end;
        }
    }

    if (recipfile && (operation == SMIME_DECRYPT)) {
        if (!(recip = load_cert(recipfile, FORMAT_PEM, NULL,
                                e, "recipient certificate file"))) {
        if ((recip = load_cert(recipfile, FORMAT_PEM, NULL, e,
                               "recipient certificate file")) == NULL) {
            ERR_print_errors(bio_err);
            goto end;
        }
    }

    if (operation == SMIME_SIGN_RECEIPT) {
        if (!(signer = load_cert(signerfile, FORMAT_PEM, NULL,
                                 e, "receipt signer certificate file"))) {
        if ((signer = load_cert(signerfile, FORMAT_PEM, NULL, e,
                                "receipt signer certificate file")) == NULL) {
            ERR_print_errors(bio_err);
            goto end;
        }
@@ -787,7 +787,7 @@ int cms_main(int argc, char **argv)
        }
        if (contfile) {
            BIO_free(indata);
            if (!(indata = BIO_new_file(contfile, "rb"))) {
            if ((indata = BIO_new_file(contfile, "rb")) == NULL) {
                BIO_printf(bio_err, "Can't read content file %s\n", contfile);
                goto end;
            }
@@ -807,7 +807,7 @@ int cms_main(int argc, char **argv)

    if (rctfile) {
        char *rctmode = (rctformat == FORMAT_ASN1) ? "rb" : "r";
        if (!(rctin = BIO_new_file(rctfile, rctmode))) {
        if ((rctin = BIO_new_file(rctfile, rctmode)) == NULL) {
            BIO_printf(bio_err, "Can't open receipt file %s\n", rctfile);
            goto end;
        }
@@ -834,7 +834,7 @@ int cms_main(int argc, char **argv)
        goto end;

    if ((operation == SMIME_VERIFY) || (operation == SMIME_VERIFY_RECEIPT)) {
        if (!(store = setup_verify(CAfile, CApath)))
        if ((store = setup_verify(CAfile, CApath)) == NULL)
            goto end;
        X509_STORE_set_verify_cb(store, cms_cb);
        if (vpmtouched)
+1 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ int crl_main(int argc, char **argv)
        goto end;

    if (do_ver) {
        if (!(store = setup_verify(CAfile, CApath)))
        if ((store = setup_verify(CAfile, CApath)) == NULL)
            goto end;
        lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
        if (lookup == NULL)
+2 −1
Original line number Diff line number Diff line
@@ -135,7 +135,8 @@ int crl2pkcs7_main(int argc, char **argv)
            nocrl = 1;
            break;
        case OPT_CERTFILE:
            if (!certflst && !(certflst = sk_OPENSSL_STRING_new_null()))
            if ((certflst == NULL)
                && (certflst = sk_OPENSSL_STRING_new_null()) == NULL)
                goto end;
            if (!sk_OPENSSL_STRING_push(certflst, *(++argv))) {
                sk_OPENSSL_STRING_free(certflst);
Loading