diff options
| author | Pan Chen | 2020-11-02 01:53:28 +0000 |
|---|---|---|
| committer | Daniel Golle | 2020-11-23 02:16:43 +0000 |
| commit | 1651a795864e7a8741cb56e7ddd2208070f2cf47 (patch) | |
| tree | 947a26e722da2b73dd4f31ca4c87bd606a258474 | |
| parent | 5e1bc3429cbf9c3be4db65ef5dbf21ea99cf5b95 (diff) | |
| download | ustream-ssl-1651a795864e7a8741cb56e7ddd2208070f2cf47.tar.gz | |
ustream-ssl: openssl: fix bio memory leak
free memory of bio method when ustream be freed
Signed-off-by: Pan Chen <serial115200@outlook.com>
| -rw-r--r-- | openssl_bio_compat.h | 7 | ||||
| -rw-r--r-- | ustream-io-openssl.c | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/openssl_bio_compat.h b/openssl_bio_compat.h index 9355c86..39a0455 100644 --- a/openssl_bio_compat.h +++ b/openssl_bio_compat.h @@ -28,6 +28,13 @@ static inline BIO_METHOD *BIO_meth_new(int type, const char *name) return bm; } +static inline void BIO_meth_free(BIO_METHOD *bm) +{ + if (bm != NULL) { + free(bm); + } +} + #endif /* OPENSSL_VERSION_NUMBER */ #endif /* OPENSSL_BIO_COMPAT_H */ diff --git a/ustream-io-openssl.c b/ustream-io-openssl.c index 606ed4a..c9d7fae 100644 --- a/ustream-io-openssl.c +++ b/ustream-io-openssl.c @@ -42,6 +42,7 @@ s_ustream_free(BIO *b) BIO_set_data(b, NULL); BIO_set_init(b, 0); BIO_clear_flags(b, ~0); + BIO_meth_free(b->method); return 1; } |