diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/hal.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/config/hal.c b/config/hal.c index af96fc2c8..4ab296159 100644 --- a/config/hal.c +++ b/config/hal.c @@ -92,6 +92,8 @@ add_option(InputOption **options, const char *key, const char *value) for (; *options; options = &(*options)->next) ; *options = xcalloc(sizeof(**options), 1); + if (!*options) /* Yeesh. */ + return; (*options)->key = xstrdup(key); (*options)->value = xstrdup(value); (*options)->next = NULL; @@ -156,7 +158,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL; char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL; char *xkb_options = NULL, *config_info = NULL; - InputOption *options = NULL; + InputOption *options = NULL, *tmpo = NULL; DeviceIntPtr dev; DBusError error; int type = TYPE_NONE; @@ -234,6 +236,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) if (NewInputDeviceRequest(options, &dev) != Success) { DebugF("[config/hal] NewInputDeviceRequest failed\n"); + dev = NULL; goto unwind; } @@ -259,6 +262,12 @@ unwind: xfree(xkb_options); if (config_info) xfree(config_info); + while (!dev && (tmpo = options)) { + options = tmpo->next; + xfree(tmpo->key); + xfree(tmpo->value); + xfree(tmpo); + } out_error: dbus_error_free(&error); |