diff --git a/programs/explorer/hal.c b/programs/explorer/hal.c index 6b5be469bdb..38b0523a58f 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 ); }