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/enc.c | |
parent | 222561fe8ef510f336417a666f69f81ddc9b8fe4 (diff) |
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/enc.c')
-rw-r--r-- | apps/enc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/apps/enc.c b/apps/enc.c index c6b8d2bbf2..83067b830a 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -313,13 +313,8 @@ int enc_main(int argc, char **argv) if (verbose) BIO_printf(bio_err, "bufsize=%d\n", bsize); - strbuf = OPENSSL_malloc(SIZE); - buff = OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize)); - if ((buff == NULL) || (strbuf == NULL)) { - BIO_printf(bio_err, "OPENSSL_malloc failure %ld\n", - (long)EVP_ENCODE_LENGTH(bsize)); - goto end; - } + strbuf = app_malloc(SIZE, "strbuf"); + buff = app_malloc(EVP_ENCODE_LENGTH(bsize), "evp buffer"); if (debug) { BIO_set_callback(in, BIO_debug_callback); |