diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-06 11:58:29 +0900 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-09-07 20:00:01 +0200 |
commit | e8596ca5c401cfdb3fe07cb1ef741cf9911bbe5c (patch) | |
tree | 92b00cabf05a14498f7594856760bf8b47a7c35e /src/backlight/backlight.c | |
parent | 3f9233e4017b53f29a2c9a106dc4ab44a94c2e5c (diff) | |
download | systemd-e8596ca5c401cfdb3fe07cb1ef741cf9911bbe5c.tar.gz |
backlight: do not unref parent device
Fixes double-free introduced by 9aadd28149ae2d8ce9956495c961d97ba4033b0e.
Diffstat (limited to 'src/backlight/backlight.c')
-rw-r--r-- | src/backlight/backlight.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c index e574a4d56d..c9d45c2253 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -61,12 +61,12 @@ static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { /* Graphics card */ if (class == 0x30000) { - *ret = TAKE_PTR(parent); + *ret = parent; return 0; } } else if (streq(subsystem, "platform")) { - *ret = TAKE_PTR(parent); + *ret = parent; return 0; } @@ -104,9 +104,8 @@ static int same_device(sd_device *a, sd_device *b) { static int validate_device(sd_device *device) { _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *enumerate = NULL; - _cleanup_(sd_device_unrefp) sd_device *parent = NULL; const char *v, *subsystem; - sd_device *other; + sd_device *parent, *other; int r; assert(device); @@ -162,8 +161,8 @@ static int validate_device(sd_device *device) { return r; FOREACH_DEVICE_AND_SUBSYSTEM(enumerate, other) { - _cleanup_(sd_device_unrefp) sd_device *other_parent = NULL; const char *other_subsystem; + sd_device *other_parent; if (same_device(device, other) > 0) continue; |