summaryrefslogtreecommitdiffstats
path: root/crypto/buffer
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2018-03-27 16:25:08 -0400
committerRich Salz <rsalz@openssl.org>2018-03-27 16:25:08 -0400
commite6e9170d6e28038768895e1af18e3aad8093bf4b (patch)
tree62f594f0968ff8d6c27795377a102e4aab373b00 /crypto/buffer
parent98c03302fb7b855647aa14022f61f5fb272e514a (diff)
Allow NULL for some _free routines.
Based on the description in https://github.com/openssl/openssl/pull/5757, this re-implements the "allow NULL to be passed" behavior of a number of xxx_free routines. I also fixed up some egregious formatting errors that were nearby. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5761)
Diffstat (limited to 'crypto/buffer')
-rw-r--r--crypto/buffer/buffer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/buffer/buffer.c b/crypto/buffer/buffer.c
index dfa5c23d1d..48618a4435 100644
--- a/crypto/buffer/buffer.c
+++ b/crypto/buffer/buffer.c
@@ -42,6 +42,8 @@ BUF_MEM *BUF_MEM_new(void)
void BUF_MEM_free(BUF_MEM *a)
{
+ if (a == NULL)
+ return;
if (a->data != NULL) {
if (a->flags & BUF_MEM_FLAG_SECURE)
OPENSSL_secure_clear_free(a->data, a->max);