gvfs r1763 - in branches/gnome-2-22: . hal



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

Log:
bgo532375 - fix strdup and g_free() confusion
2008-05-09  Federico Mena Quintero  <federico novell com>

	Merged from trunk:

	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:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/hal/hal-device.c
   branches/gnome-2-22/hal/hal-pool.c

Modified: branches/gnome-2-22/hal/hal-device.c
==============================================================================
--- branches/gnome-2-22/hal/hal-device.c	(original)
+++ branches/gnome-2-22/hal/hal-device.c	Sat May 10 01:08:07 2008
@@ -245,7 +245,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: branches/gnome-2-22/hal/hal-pool.c
==============================================================================
--- branches/gnome-2-22/hal/hal-pool.c	(original)
+++ branches/gnome-2-22/hal/hal-pool.c	Sat May 10 01:08:07 2008
@@ -361,9 +361,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]