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>
This commit is contained in:
Rami Ylimäki 2011-03-04 17:55:33 +02:00 committed by Peter Hutterer
parent 8d30aff4aa
commit 4114533db6
2 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);
}