summaryrefslogtreecommitdiffstats
path: root/apps/dgst.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-03-12 11:25:03 +0000
committerMatt Caswell <matt@openssl.org>2015-03-17 13:39:53 +0000
commitbe1477adc97e76f4b83ed8075589f529069bd5d1 (patch)
tree451b6068c8ca61ebbe8047bd6dfc6fbbdc8419a4 /apps/dgst.c
parenta561bfe944c0beba73551731cb98af70dfee3549 (diff)
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 <tjh@openssl.org>
Diffstat (limited to 'apps/dgst.c')
-rw-r--r--apps/dgst.c10
1 files 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;