summaryrefslogtreecommitdiffstats
path: root/apps/x509.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-03-04 17:49:51 +0000
committerMatt Caswell <matt@openssl.org>2015-03-05 09:15:08 +0000
commitd6b4a41d100c2d3b401baf8edc34085ff610c5ba (patch)
tree8218609640b11832193a700d07a139f4246d8ecd /apps/x509.c
parent9fdbaf3a322689a58381c724e4f3497320a69581 (diff)
Unchecked malloc fixes
Miscellaneous unchecked malloc fixes. Also fixed some mem leaks on error paths as I spotted them along the way. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 918bb8652969fd53f0c390c1cd909265ed502c7e) Conflicts: crypto/bio/bss_dgram.c
Diffstat (limited to 'apps/x509.c')
-rw-r--r--apps/x509.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/x509.c b/apps/x509.c
index d005c82bb1..864a60dda2 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -829,6 +829,11 @@ int MAIN(int argc, char **argv)
z = i2d_X509(x, NULL);
m = OPENSSL_malloc(z);
+ if (!m) {
+ BIO_printf(bio_err, "Out of memory\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
d = (unsigned char *)m;
z = i2d_X509_NAME(X509_get_subject_name(x), &d);