gvfs r1762 - in trunk: . hal



Author: federico
Date: Sat May 10 01:06:38 2008
New Revision: 1762
URL: http://svn.gnome.org/viewvc/gvfs?rev=1762&view=rev

Log:
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>


Modified:
   trunk/ChangeLog
   trunk/hal/hal-device.c
   trunk/hal/hal-pool.c

Modified: trunk/hal/hal-device.c
==============================================================================
--- trunk/hal/hal-device.c	(original)
+++ trunk/hal/hal-device.c	Sat May 10 01:06:38 2008
@@ -243,7 +243,7 @@
   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;

Modified: trunk/hal/hal-pool.c
==============================================================================
--- trunk/hal/hal-pool.c	(original)
+++ trunk/hal/hal-pool.c	Sat May 10 01:06:38 2008
@@ -359,9 +359,8 @@
     {
       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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]