diff options
author | Corey Minyard <cminyard@mvista.com> | 2019-01-21 17:47:02 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2019-01-21 17:47:02 +1000 |
commit | c6048af23c577bcf85f15122dd03b65f959c9ecb (patch) | |
tree | 9e36e4a8dfd6c9b8824f349080eebf0d8866b8bc /test/recipes | |
parent | 37842dfaebcf28b4ca452c6abd93ebde1b4aa6dc (diff) |
Fix a memory leak in the mem bio
If you use a BIO and set up your own buffer that is not freed, the
memory bio will leak the BIO_BUF_MEM object it allocates.
The trouble is that the BIO_BUF_MEM is allocated and kept around,
but it is not freed if BIO_NOCLOSE is set.
The freeing of BIO_BUF_MEM was fairly confusing, simplify things
so mem_buf_free only frees the memory buffer and free the BIO_BUF_MEM
in mem_free(), where it should be done.
Alse add a test for a leak in the memory bio
Setting a memory buffer caused a leak.
Signed-off-by: Corey Minyard <minyard@acm.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8051)
Diffstat (limited to 'test/recipes')
-rw-r--r-- | test/recipes/90-test_bio_memleak.t | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/recipes/90-test_bio_memleak.t b/test/recipes/90-test_bio_memleak.t new file mode 100644 index 0000000000..93f7f928a7 --- /dev/null +++ b/test/recipes/90-test_bio_memleak.t @@ -0,0 +1,12 @@ +#! /usr/bin/env perl +# Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the OpenSSL license (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + + +use OpenSSL::Test::Simple; + +simple_test("test_bio_memleak", "bio_memleak_test"); |