diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:48:31 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:48:31 -0400 |
commit | 68dc682499ea3fe27d909c946d7abd39062d6efd (patch) | |
tree | 3478a6fb3699bdfa08d5871848696882ee1c24db /apps/dgst.c | |
parent | 222561fe8ef510f336417a666f69f81ddc9b8fe4 (diff) | |
download | openssl-new-68dc682499ea3fe27d909c946d7abd39062d6efd.tar.gz |
In apps, malloc or die
No point in proceeding if you're out of memory. So change
*all* OPENSSL_malloc calls in apps to use the new routine which
prints a message and exits.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/dgst.c')
-rw-r--r-- | apps/dgst.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/apps/dgst.c b/apps/dgst.c index 106e939fbf..3ff47501bd 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -139,10 +139,7 @@ int dgst_main(int argc, char **argv) int engine_impl = 0; prog = opt_progname(argv[0]); - if ((buf = OPENSSL_malloc(BUFSIZE)) == NULL) { - BIO_printf(bio_err, "%s: out of memory\n", prog); - goto end; - } + buf = app_malloc(BUFSIZE, "I/O buffer"); md = EVP_get_digestbyname(prog); prog = opt_init(argc, argv, dgst_options); @@ -394,11 +391,7 @@ int dgst_main(int argc, char **argv) goto end; } siglen = EVP_PKEY_size(sigkey); - sigbuf = OPENSSL_malloc(siglen); - if (!sigbuf) { - BIO_printf(bio_err, "Out of memory\n"); - goto end; - } + sigbuf = app_malloc(siglen, "signature buffer"); siglen = BIO_read(sigbio, sigbuf, siglen); BIO_free(sigbio); if (siglen <= 0) { |