Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak [ ssl handshake ] #307

Open
rainroot opened this issue Apr 9, 2024 · 0 comments
Open

memory leak [ ssl handshake ] #307

rainroot opened this issue Apr 9, 2024 · 0 comments

Comments

@rainroot
Copy link

rainroot commented Apr 9, 2024

I used ChatGPT because I'm not good at English. Please understand.

A memory leak of 116 bytes occurs during SSL handshake.
The memory leak was resolved by modifying it as follows:

openvpn3/openvpn/openssl/bio/bio_memq_stream.hpp 
@@ -200,7 +200,9 @@

     static inline void free_bio_method()
     {
-        BIO_meth_free(memq_method);
+        if(memq_method != nullptr){
+            BIO_meth_free(memq_method);
+        }
         memq_method = nullptr;
     }
 }; // class bio_memq_internal
@@ -215,6 +217,11 @@
     bio_memq_internal::init_static();
 }

+inline void free_bio_method()
+{
+    bio_memq_internal::free_bio_method();
+}
+
 inline BIO_METHOD *BIO_s_memq(void)
 {
     return (bio_memq_internal::memq_method);
openvpn3/openvpn/common/stop.hpp
@@ -83,6 +83,10 @@
     {
     }

+    ~Stop(){
+        bmq_stream::free_bio_method();
+    }
+
     void stop()
     {
         std::lock_guard<std::recursive_mutex> lock(mutex);

Please review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant