1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

udev: add missing initialization to fix freeing invalid address

This commit is contained in:
Yu Watanabe 2021-04-07 19:09:50 +09:00
parent 7211773a55
commit b08c3fbe0e

View File

@ -358,8 +358,8 @@ static int dev_pci_slot(sd_device *dev, struct netnames *names) {
*/
if (naming_scheme_has(NAMING_SLOT_FUNCTION_ID) &&
sd_device_get_sysattr_value(hotplug_slot_dev, "function_id", &attr) >= 0) {
_cleanup_free_ char *str = NULL;
int function_id;
_cleanup_free_ char *str;
if (safe_atoi(attr, &function_id) >= 0 &&
asprintf(&str, "%s/%08x/", slots, function_id) >= 0 &&