[haiku-commits] haiku: hrev44634 - src/preferences/virtualmemory

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 13 Sep 2012 20:24:46 +0200 (CEST)

hrev44634 adds 1 changeset to branch 'master'
old head: 517a59c9a1dd1df14944e61474af62c945af3a31
new head: f78dd1249a1c71736fc7725db6b955d2fa6d3ff0

----------------------------------------------------------------------------

f78dd12: VM Preflet: Use AutoDeleter on the settings
  
  * Prevents a minor memory leak
  * Thanks for catching this Axel!

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44634
Commit:      f78dd1249a1c71736fc7725db6b955d2fa6d3ff0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f78dd12
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Thu Sep 13 16:10:42 2012 UTC

----------------------------------------------------------------------------

1 file changed, 3 insertions(+)
src/preferences/virtualmemory/Settings.cpp |    3 +++

----------------------------------------------------------------------------

diff --git a/src/preferences/virtualmemory/Settings.cpp 
b/src/preferences/virtualmemory/Settings.cpp
index 08f6102..9b9b21f 100644
--- a/src/preferences/virtualmemory/Settings.cpp
+++ b/src/preferences/virtualmemory/Settings.cpp
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <AutoDeleter.h>
 #include <File.h>
 #include <FindDirectory.h>
 #include <Path.h>
@@ -138,6 +139,8 @@ Settings::ReadSwapSettings()
        void* settings = load_driver_settings(kVirtualMemorySettings);
        if (settings == NULL)
                return kErrorSettingsNotFound;
+       CObjectDeleter<void, status_t> settingDeleter(settings,
+               &unload_driver_settings);
 
        const char* enabled = get_driver_parameter(settings, "vm", NULL, NULL);
        const char* automatic = get_driver_parameter(settings, "swap_auto",


Other related posts: