From 56490fc26ff9dc2da162e6dc0675762edf607c1d Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Thu, 12 Mar 2015 11:25:03 +0000 Subject: [PATCH] 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: Tim Hudson (cherry picked from commit be1477adc97e76f4b83ed8075589f529069bd5d1) --- apps/dgst.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/dgst.c b/apps/dgst.c index 47c2f69e1b..95e5fa3fc7 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -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; -- 2.25.1