udev-rules: fix possible assertion

On 'remove' action, event->dev_db_clone is NULL. So, `IMPORT{db}` rule
on 'remove' action triggers assertion. This fixes the issue.
This commit is contained in:
Yu Watanabe
2018-11-15 15:50:27 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent 28f38a7634
commit a6da77b71b
+2 -1
View File
@@ -2043,7 +2043,8 @@ int udev_rules_apply_to_event(
const char *key;
key = rules_str(rules, cur->key.value_off);
if (sd_device_get_property_value(event->dev_db_clone, key, &val) >= 0)
if (event->dev_db_clone &&
sd_device_get_property_value(event->dev_db_clone, key, &val) >= 0)
device_add_property(dev, key, val);
else if (cur->key.op != OP_NOMATCH)
goto nomatch;