Skip to content

Commit

Permalink
config: Ensure that stolen option list elements are released.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Erkki Seppälä <[email protected]>
Reviewed-by: Adam Jackson <[email protected]>
Reviewed-by: Peter Hutterer <[email protected]>
Signed-off-by: Peter Hutterer <[email protected]>
  • Loading branch information
rylimaki authored and whot committed Mar 8, 2011
1 parent 8d30aff commit 4114533
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions config/hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ device_added(LibHalContext *hal_ctx, const char *udi)
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);
}

Expand Down
6 changes: 3 additions & 3 deletions config/udev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 4114533

Please sign in to comment.