summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-05-05 14:37:07 -0400
committerAdam Jackson <ajax@redhat.com>2008-05-16 09:49:20 -0400
commitf52f6c5c7efc281f9ac204fbaa4f71383df7463d (patch)
tree460ee3b35d05bc100702e23a4c1d836419e795d3 /config
parent99e4531f7c3fafce065dfd21f65bad1cf190c3f1 (diff)
Fix hal shutdown crash.
Removing the device invalidates its ->next pointer. Copy it aside before destroying the device.
Diffstat (limited to 'config')
-rw-r--r--config/hal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/config/hal.c b/config/hal.c
index e197cb1b4..1d62a1de1 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -74,7 +74,7 @@ remove_device(DeviceIntPtr dev)
static void
device_removed(LibHalContext *ctx, const char *udi)
{
- DeviceIntPtr dev;
+ DeviceIntPtr dev, next;
char *value;
value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */
@@ -82,11 +82,13 @@ device_removed(LibHalContext *ctx, const char *udi)
return;
sprintf(value, "hal:%s", udi);
- for (dev = inputInfo.devices; dev; dev = dev->next) {
+ for (dev = inputInfo.devices; dev; dev = next) {
+ next = dev->next;
if (dev->config_info && strcmp(dev->config_info, value) == 0)
remove_device(dev);
}
- for (dev = inputInfo.off_devices; dev; dev = dev->next) {
+ for (dev = inputInfo.off_devices; dev; dev = next) {
+ next = dev->next;
if (dev->config_info && strcmp(dev->config_info, value) == 0)
remove_device(dev);
}