[Libreoffice-commits] online.git: Branch 'libreoffice-5-4' - net/Socket.hpp net/Ssl.cpp wsd/FileServer.hpp wsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 29 20:34:28 UTC 2018


 net/Socket.hpp     |    4 ++++
 net/Ssl.cpp        |    1 +
 wsd/FileServer.hpp |    3 +++
 wsd/LOOLWSD.cpp    |    2 ++
 4 files changed, 10 insertions(+)

New commits:
commit 90bb229f4dd23353ccce642456f2de471954807f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Jul 2 22:10:23 2017 -0400

    wsd: free leaking memory
    
    With help from Valgrind to find and verify
    these leaks.
    
    Change-Id: I3afeed89dc4bcd714a222f81822144477a346fb0
    Reviewed-on: https://gerrit.libreoffice.org/39464
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit 4f8ebca0cb3612ddbdcfbee6ea5a462b04689738)
    Reviewed-on: https://gerrit.libreoffice.org/48675
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/net/Socket.hpp b/net/Socket.hpp
index 7c7b55ab..3997c645 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -613,6 +613,10 @@ private:
 
             // Invoke the virtual implementation.
             pollingThread();
+
+            // Release sockets.
+            _pollSockets.clear();
+            _newSockets.clear();
         }
         catch (const std::exception& exc)
         {
diff --git a/net/Ssl.cpp b/net/Ssl.cpp
index 64f279d4..5a9f8280 100644
--- a/net/Ssl.cpp
+++ b/net/Ssl.cpp
@@ -128,6 +128,7 @@ SslContext::SslContext(const std::string& certFilePath,
 
 SslContext::~SslContext()
 {
+    SSL_CTX_free(_ctx);
     EVP_cleanup();
     ERR_free_strings();
     CRYPTO_set_locking_callback(0);
diff --git a/wsd/FileServer.hpp b/wsd/FileServer.hpp
index 01d5918c..c3ff59b7 100644
--- a/wsd/FileServer.hpp
+++ b/wsd/FileServer.hpp
@@ -31,6 +31,9 @@ public:
     /// Read all files that we can serve into memory and compress them.
     static void initialize();
 
+    /// Clean cached files.
+    static void uninitialize() { FileHash.clear(); }
+
     static void readDirToHash(const std::string &basePath, const std::string &path);
 
     static const std::string *getCompressedFile(const std::string &path);
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 0dccb5d4..e6ebfac2 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2609,6 +2609,8 @@ int LOOLWSD::innerMain()
 
 void LOOLWSD::cleanup()
 {
+    FileServerRequestHandler::uninitialize();
+
     // Finally, we no longer need SSL.
     if (LOOLWSD::isSSLEnabled())
     {


More information about the Libreoffice-commits mailing list