From 905fba1f0b04dc26ab0bc985529f1633dacea423 Mon Sep 17 00:00:00 2001 From: Jorg Schuler Date: Tue, 28 Feb 2006 11:06:09 +0000 Subject: * ipod-device.c: (ipod_device_set_property): fixed possible segfault when hald is present. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1210 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- src/ipod-device.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ipod-device.c b/src/ipod-device.c index 26c25bb..876b566 100644 --- a/src/ipod-device.c +++ b/src/ipod-device.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-02-19 19:41:56 jcs> +/* Time-stamp: <2006-02-28 20:04:37 jcs> | | Copyright (C) 2005 Jorg Schuler | Part of the gtkpod project. @@ -537,33 +537,35 @@ ipod_device_set_property(GObject *object, guint prop_id, case PROP_DEVICE_PATH: case PROP_HAL_VOLUME_ID: str = g_value_get_string(value); + volumes = NULL; if (device->priv->hal_context) { volumes = libhal_manager_find_device_string_match( device->priv->hal_context, "block.device", str, &volume_count, NULL); - if(volume_count == 0) { + if(volume_count == 0) + { libhal_free_string_array(volumes); volumes = libhal_manager_find_device_string_match( device->priv->hal_context, "volume.mount_point", str, &volume_count, NULL); - - if(volume_count >= 1) - str = volumes[0]; - } else { + } + if(volume_count >= 1) + { str = volumes[0]; } - libhal_free_string_array(volumes); } #ifdef HAVE_LIBHAL g_free_if_not_null(device->priv->hal_volume_id); - device->priv->hal_volume_id = g_strdup(str); + device->priv->hal_volume_id = g_strdup (str); #else /* JCS for libgpod */ g_free (device->priv->mount_point); device->priv->mount_point = g_strdup (str); /* end JCS for libgpod */ #endif + if (volumes) + libhal_free_string_array(volumes); device->priv->is_ipod = ipod_device_reload(device); break; case PROP_DEVICE_NAME: -- cgit