Module: wine Branch: master Commit: 1f90e8865746eba755a0ed87051abf8ea01cec65 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1f90e8865746eba755a0ed8705...
Author: Rob Shearman rob@codeweavers.com Date: Thu Dec 27 10:01:13 2007 +0000
explorer: Fix memory leak when one or more properties are not present on a hal device.
---
programs/explorer/hal.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/programs/explorer/hal.c b/programs/explorer/hal.c index 6b5be46..38b0523 100644 --- a/programs/explorer/hal.c +++ b/programs/explorer/hal.c @@ -112,7 +112,10 @@ static WINE_EXCEPTION_FILTER(assert_fault) static void new_device( LibHalContext *ctx, const char *udi ) { DBusError error; - char *parent, *mount_point, *device, *type; + char *parent = NULL; + char *mount_point = NULL; + char *device = NULL; + char *type = NULL;
p_dbus_error_init( &error );
@@ -133,15 +136,14 @@ static void new_device( LibHalContext *ctx, const char *udi )
add_dos_device( udi, device, mount_point, type );
- if (type) p_libhal_free_string( type ); - p_libhal_free_string( parent ); - p_libhal_free_string( device ); - p_libhal_free_string( mount_point ); - /* add property watch for mount point */ p_libhal_device_add_property_watch( ctx, udi, &error );
done: + if (type) p_libhal_free_string( type ); + if (parent) p_libhal_free_string( parent ); + if (device) p_libhal_free_string( device ); + if (mount_point) p_libhal_free_string( mount_point ); p_dbus_error_free( &error ); }