From d6b4a41d100c2d3b401baf8edc34085ff610c5ba Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 4 Mar 2015 17:49:51 +0000 Subject: 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 (cherry picked from commit 918bb8652969fd53f0c390c1cd909265ed502c7e) Conflicts: crypto/bio/bss_dgram.c --- apps/ca.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'apps/ca.c') diff --git a/apps/ca.c b/apps/ca.c index f0a19cf11c..3215c56dbf 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -563,10 +563,18 @@ int MAIN(int argc, char **argv) #ifdef OPENSSL_SYS_VMS len = strlen(s) + sizeof(CONFIG_FILE); tofree = OPENSSL_malloc(len); + if(!tofree) { + BIO_printf(bio_err, "Out of memory\n"); + goto err; + } strcpy(tofree, s); #else len = strlen(s) + sizeof(CONFIG_FILE) + 1; tofree = OPENSSL_malloc(len); + if(!tofree) { + BIO_printf(bio_err, "Out of memory\n"); + goto err; + } BUF_strlcpy(tofree, s, len); BUF_strlcat(tofree, "/", len); #endif -- cgit v1.2.3