commit 636cb95e3d68e885d9a5688ebc12e975b55a2c35
Author: Federico Mena Quintero <federico@gnu.org>
Date:   Fri May 9 12:10:03 2008 -0500

    bgo532375 - fix strdup and g_free() confusion
    2008-05-09  Federico Mena Quintero  <federico@novell.com>
    
    	http://bugzilla.gnome.org/show_bug.cgi?id=532375 - Fix strdup() /
    	g_free() confusion.
    
    	* hal/hal-device.c (hal_device_new_from_udi_and_properties):
    	g_strdup() the UDI.  We can't just steal it, since it comes from
    	libhal, which uses strdup() (and we do g_free() in our finalizer).
    
    	* hal/hal-pool.c (hal_pool_new): Free the actual device strings here.
    
    Signed-off-by: Federico Mena Quintero <federico@gnu.org>

diff --git a/ChangeLog b/ChangeLog
index cae9976..1d8840b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-05-09  Federico Mena Quintero  <federico@novell.com>
+
+	http://bugzilla.gnome.org/show_bug.cgi?id=532375 - Fix strdup() /
+	g_free() confusion.
+
+	* hal/hal-device.c (hal_device_new_from_udi_and_properties):
+	g_strdup() the UDI.  We can't just steal it, since it comes from
+	libhal, which uses strdup() (and we do g_free() in our finalizer).
+
+	* hal/hal-pool.c (hal_pool_new): Free the actual device strings here.
+
 2008-03-28  Alexander Larsson  <alexl@redhat.com>
 
 	* daemon/Makefile.am (gvfsd_smb_SOURCES):
diff --git a/hal/hal-device.c b/hal/hal-device.c
index 2650aaf..2165ff4 100644
--- a/hal/hal-device.c
+++ b/hal/hal-device.c
@@ -245,7 +245,7 @@ hal_device_new_from_udi_and_properties (LibHalContext *hal_ctx,
   HalDevice *device;
   
   device = HAL_DEVICE (g_object_new (HAL_TYPE_DEVICE, NULL));
-  device->priv->udi = udi;
+  device->priv->udi = g_strdup (udi);
   device->priv->hal_ctx = hal_ctx;
   device->priv->properties = properties;
   return device;
diff --git a/hal/hal-pool.c b/hal/hal-pool.c
index 0f890e9..8e3bdf7 100644
--- a/hal/hal-pool.c
+++ b/hal/hal-pool.c
@@ -359,9 +359,8 @@ hal_pool_new (char **cap_only)
     {
       for (i = 0; i < num_devices; i++)
         hal_pool_add_device_by_udi_and_properties (pool, devices[i], properties[i], FALSE);
-      /* _add_device_by_udi_and_properties steals the given parameters */
-      free (devices);
-      free (properties);
+      libhal_free_string_array (devices);
+      free (properties); /* hal_pool_add_device_by_udi_and_properties steals the given properties */
       goto out;
     }
 #endif
