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/dsaparam.c | |
parent | 222561fe8ef510f336417a666f69f81ddc9b8fe4 (diff) | |
download | openssl-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/dsaparam.c')
-rw-r--r-- | apps/dsaparam.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/apps/dsaparam.c b/apps/dsaparam.c index 5aa6e2ccfc..afc8a82b01 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -268,16 +268,9 @@ int dsaparam_main(int argc, char **argv) } if (C) { - unsigned char *data; - int len, bits_p; - - len = BN_num_bytes(dsa->p); - bits_p = BN_num_bits(dsa->p); - data = OPENSSL_malloc(len + 20); - if (data == NULL) { - perror("OPENSSL_malloc"); - goto end; - } + int len = BN_num_bytes(dsa->p); + int bits_p = BN_num_bits(dsa->p); + unsigned char *data = app_malloc(len + 20, "BN space"); BIO_printf(bio_out, "DSA *get_dsa%d()\n{\n", bits_p); print_bignum_var(bio_out, dsa->p, "dsap", len, data); |