Commit 56490fc2 authored by Matt Caswell's avatar Matt Caswell
Browse files

Move malloc fail checks closer to malloc

Move memory allocation failure checks closer to the site of the malloc in
dgst app. Only a problem if the debug flag is set...but still should be
fixed.

Reviewed-by: default avatarTim Hudson <tjh@openssl.org>
(cherry picked from commit be1477ad)
parent f2e95a02
Loading
Loading
Loading
Loading
+5 −5
Changes for apps/dgst.c: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -293,6 +293,11 @@ int MAIN(int argc, char **argv)

    in = BIO_new(BIO_s_file());
    bmd = BIO_new(BIO_f_md());
    if ((in == NULL) || (bmd == NULL)) {
        ERR_print_errors(bio_err);
        goto end;
    }

    if (debug) {
        BIO_set_callback(in, BIO_debug_callback);
        /* needed for windows 3.1 */
@@ -304,11 +309,6 @@ int MAIN(int argc, char **argv)
        goto end;
    }

    if ((in == NULL) || (bmd == NULL)) {
        ERR_print_errors(bio_err);
        goto end;
    }

    if (out_bin == -1) {
        if (keyfile)
            out_bin = 1;