diff options
author | Adam Jackson <ajax@redhat.com> | 2008-05-05 14:37:07 -0400 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-05-16 17:20:08 +0300 |
commit | d5a7badd6a0ea4ecbe76f0205aa53b42f7cd90dc (patch) | |
tree | 96e0d9695b288665778590e337bc50833fa05ed3 | |
parent | 458b487723a7beb792857c920e9be22c2ce4625d (diff) |
Fix hal shutdown crash.
Removing the device invalidates its ->next pointer. Copy it aside before
destroying the device.
(cherry picked from commit f52f6c5c7efc281f9ac204fbaa4f71383df7463d)
-rw-r--r-- | config/hal.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/config/hal.c b/config/hal.c index 16f16ecb8..bdf7d6c13 100644 --- a/config/hal.c +++ b/config/hal.c @@ -63,7 +63,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 */ @@ -71,11 +71,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); } |