diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-12 11:25:03 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-17 13:49:31 +0000 |
commit | d3554bff69d97b15fef063bdb0176a0b68021325 (patch) | |
tree | 0d98789c4e10b0cf782b38177dea7f2717980207 /apps | |
parent | 3f9117e161246f2f09754e277f2c986a840c1f74 (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>
(cherry picked from commit be1477adc97e76f4b83ed8075589f529069bd5d1)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dgst.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/dgst.c b/apps/dgst.c index 8459c19625..ad2f2348ac 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -287,6 +287,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 */ @@ -298,11 +303,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; |