aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dsaparam.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-04-30 17:48:31 -0400
committerRich Salz <rsalz@openssl.org>2015-04-30 17:48:31 -0400
commit68dc682499ea3fe27d909c946d7abd39062d6efd (patch)
tree3478a6fb3699bdfa08d5871848696882ee1c24db /apps/dsaparam.c
parent222561fe8ef510f336417a666f69f81ddc9b8fe4 (diff)
downloadopenssl-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.c13
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);