summaryrefslogtreecommitdiffstats
path: root/crypto/bio/b_print.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:09:57 +0000
commit918bb8652969fd53f0c390c1cd909265ed502c7e (patch)
tree883afa725e4529a992611b5b02e8b5c784463e99 /crypto/bio/b_print.c
parent618be04e407a7800a7198ac87fa5e8cee7c6e10b (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>
Diffstat (limited to 'crypto/bio/b_print.c')
-rw-r--r--crypto/bio/b_print.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c
index 5dc7630009..f7940f28be 100644
--- a/crypto/bio/b_print.c
+++ b/crypto/bio/b_print.c
@@ -713,6 +713,10 @@ doapr_outch(char **sbuffer,
if (*maxlen == 0)
*maxlen = 1024;
*buffer = OPENSSL_malloc(*maxlen);
+ if(!*buffer) {
+ /* Panic! Can't really do anything sensible. Just return */
+ return;
+ }
if (*currlen > 0) {
assert(*sbuffer != NULL);
memcpy(*buffer, *sbuffer, *currlen);
@@ -721,6 +725,10 @@ doapr_outch(char **sbuffer,
} else {
*maxlen += 1024;
*buffer = OPENSSL_realloc(*buffer, *maxlen);
+ if(!*buffer) {
+ /* Panic! Can't really do anything sensible. Just return */
+ return;
+ }
}
}
/* What to do if *buffer is NULL? */