[Libreoffice-commits] online.git: loolwsd/LOOLTool.cpp

Miklos Vajna vmiklos at collabora.co.uk
Thu Apr 21 06:37:58 UTC 2016


 loolwsd/LOOLTool.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9059774e64dd8c9939d5ecf5263cc8f428c411b7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Apr 21 08:37:21 2016 +0200

    LOOLTool: fix potential memory leak
    
    Change-Id: Ib1c9bb5cbbef709882580de40500c1a9c8f70e4a

diff --git a/loolwsd/LOOLTool.cpp b/loolwsd/LOOLTool.cpp
index a797b77..2e0acfc 100644
--- a/loolwsd/LOOLTool.cpp
+++ b/loolwsd/LOOLTool.cpp
@@ -224,13 +224,13 @@ void Tool::handleOption(const std::string& optionName,
 
 int Tool::main(const std::vector<std::string>& args)
 {
-    Thread *clients[_numWorkers];
+    std::vector<std::unique_ptr<Thread>> clients(_numWorkers);
 
     size_t chunk = (args.size() + _numWorkers - 1) / _numWorkers;
     size_t offset = 0;
     for (unsigned i = 0; i < _numWorkers; i++)
     {
-        clients[i] = new Thread();
+        clients[i].reset(new Thread());
         size_t toCopy = std::min(args.size() - offset, chunk);
         if (toCopy > 0)
         {


More information about the Libreoffice-commits mailing list