backlight: do not unref parent device
Fixes double-free introduced by 9aadd28149
.
This commit is contained in:
parent
3f9233e401
commit
e8596ca5c4
|
@ -61,12 +61,12 @@ static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) {
|
||||||
|
|
||||||
/* Graphics card */
|
/* Graphics card */
|
||||||
if (class == 0x30000) {
|
if (class == 0x30000) {
|
||||||
*ret = TAKE_PTR(parent);
|
*ret = parent;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (streq(subsystem, "platform")) {
|
} else if (streq(subsystem, "platform")) {
|
||||||
*ret = TAKE_PTR(parent);
|
*ret = parent;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +104,8 @@ static int same_device(sd_device *a, sd_device *b) {
|
||||||
|
|
||||||
static int validate_device(sd_device *device) {
|
static int validate_device(sd_device *device) {
|
||||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *enumerate = NULL;
|
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *enumerate = NULL;
|
||||||
_cleanup_(sd_device_unrefp) sd_device *parent = NULL;
|
|
||||||
const char *v, *subsystem;
|
const char *v, *subsystem;
|
||||||
sd_device *other;
|
sd_device *parent, *other;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(device);
|
assert(device);
|
||||||
|
@ -162,8 +161,8 @@ static int validate_device(sd_device *device) {
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
FOREACH_DEVICE_AND_SUBSYSTEM(enumerate, other) {
|
FOREACH_DEVICE_AND_SUBSYSTEM(enumerate, other) {
|
||||||
_cleanup_(sd_device_unrefp) sd_device *other_parent = NULL;
|
|
||||||
const char *other_subsystem;
|
const char *other_subsystem;
|
||||||
|
sd_device *other_parent;
|
||||||
|
|
||||||
if (same_device(device, other) > 0)
|
if (same_device(device, other) > 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue