Bug 117623 - Memory leak in halbackend.cpp
Summary: Memory leak in halbackend.cpp
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: media (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Kevin Ottens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-03 21:08 UTC by Chris Spiegel
Modified: 2006-06-15 23:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Spiegel 2005-12-03 21:08:07 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
Compiler:          gcc 3.3.6 
OS:                Linux

In kdebase/kioslave/media/mediamanager/halbackend.cpp, the libhal_get_all_devices() function is used twice.  The memory returned by this function needs to be freed with libhal_free_string_array().  The two instances are in HALBackend::~HALBackend() and  HALBackend::ListDevices().
Comment 1 Kevin Ottens 2006-06-15 23:37:13 UTC
SVN commit 551884 by ervin:

Avoid to leak devices lists.

Thanks for pointing this.
BUG: 117623


 M  +4 -0      halbackend.cpp  


--- branches/KDE/3.5/kdebase/kioslave/media/mediamanager/halbackend.cpp #551883:551884
@@ -84,6 +84,8 @@
             }
         }
 
+        libhal_free_string_array( halDeviceList );
+
         DBusError error;
         dbus_error_init(&error);
         libhal_ctx_shutdown(m_halContext, &error);
@@ -173,6 +175,8 @@
     for (int i = 0; i < numDevices; i++)
         AddDevice(halDeviceList[i], false);
 
+    libhal_free_string_array( halDeviceList );
+
     return true;
 }