summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRami Ylimäki <rami.ylimaki@vincit.fi>2011-03-04 17:55:33 +0200
committerJeremy Huddleston <jeremyhu@apple.com>2011-03-27 22:15:20 -0700
commitd1caa195abc648560f81356c40f08e7630544db9 (patch)
treeb570f1cc81881c70cfec2c6fe645dcf675caf1c4
parent241de6d72bdda9c925e22538aba4f91643ae0897 (diff)
config: Ensure that stolen option list elements are released.
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 <rami.ylimaki@vincit.fi> Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 4114533db6704324fc26f28a444415e325ace8e0)
-rw-r--r--config/hal.c6
-rw-r--r--config/udev.c6
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);
}