From 4114533db6704324fc26f28a444415e325ace8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rami=20Ylim=C3=A4ki?= Date: Fri, 4 Mar 2011 17:55:33 +0200 Subject: [PATCH] config: Ensure that stolen option list elements are released. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NewInputDeviceRequest steals the contents of option list elements but doesn't use the elements themselves for anything. Therefore the list elements need to be released always. Signed-off-by: Rami Ylimäki Reviewed-by: Erkki Seppälä Reviewed-by: Adam Jackson Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- config/hal.c | 6 +++--- config/udev.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/hal.c b/config/hal.c index 0b848a0f7..297520aa6 100644 --- a/config/hal.c +++ b/config/hal.c @@ -392,10 +392,10 @@ unwind: free(driver); free(name); free(config_info); - while (!dev && (tmpo = options)) { + while ((tmpo = options)) { options = tmpo->next; - free(tmpo->key); - free(tmpo->value); + free(tmpo->key); /* NULL if dev != NULL */ + free(tmpo->value); /* NULL if dev != NULL */ free(tmpo); } diff --git a/config/udev.c b/config/udev.c index ab27c98a5..678e47a39 100644 --- a/config/udev.c +++ b/config/udev.c @@ -197,10 +197,10 @@ device_added(struct udev_device *udev_device) unwind: free(config_info); - while (!dev && (tmpo = options)) { + while ((tmpo = options)) { options = tmpo->next; - free(tmpo->key); - free(tmpo->value); + free(tmpo->key); /* NULL if dev != NULL */ + free(tmpo->value); /* NULL if dev != NULL */ free(tmpo); }