[PATCH] coverity#988423: fix memory leak

Markus Mohrhard (via Code Review) gerrit at gerrit.libreoffice.org
Wed Feb 27 21:30:27 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2458

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/58/2458/1

coverity#988423: fix memory leak

Change-Id: I3ac2cca7e24e6cc1b47b42c2d42bc7caee91b559
---
M sd/source/ui/remotecontrol/BluetoothServer.cxx
M sd/source/ui/remotecontrol/BluetoothServer.hxx
2 files changed, 4 insertions(+), 2 deletions(-)



diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index 9c271aa..475e0c1 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -586,7 +586,7 @@
     mpCommunicators( pCommunicators )
 {
 #ifdef LINUX_BLUETOOTH
-    mpImpl = new BluetoothServerImpl();
+    mpImpl.reset(new BluetoothServerImpl());
 #endif
     (void) mpImpl; // Avoid warning: private field 'mpImpl' is not used
 }
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.hxx b/sd/source/ui/remotecontrol/BluetoothServer.hxx
index 8078ede..bfaeccc 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.hxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.hxx
@@ -12,6 +12,8 @@
 #include <osl/thread.hxx>
 #include <vector>
 
+#include <boost/scoped_ptr.hpp>
+
 namespace sd
 {
     class Communicator;
@@ -40,7 +42,7 @@
         enum { UNKNOWN, DISCOVERABLE, NOT_DISCOVERABLE } meWasDiscoverable;
         static BluetoothServer *spServer;
 
-        BluetoothServerImpl *mpImpl;
+        boost::scoped_ptr<BluetoothServerImpl> mpImpl;
         virtual void SAL_CALL run();
 
         void cleanupCommunicators();

-- 
To view, visit https://gerrit.libreoffice.org/2458
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ac2cca7e24e6cc1b47b42c2d42bc7caee91b559
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Markus Mohrhard <markus.mohrhard at googlemail.com>



More information about the LibreOffice mailing list