summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRami Ylimäki <rami.ylimaki@vincit.fi>2011-03-04 17:55:33 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2011-03-09 07:59:41 +1000
commit4114533db6704324fc26f28a444415e325ace8e0 (patch)
tree8c1be4f3854ce2602f77efdb771ea367d1628f5f
parent8d30aff4aa708b9b885d492602ced7493a96a4df (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>
-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);
}