]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: add missing initialization to fix freeing invalid address
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 7 Apr 2021 10:09:50 +0000 (19:09 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 7 Apr 2021 16:35:43 +0000 (01:35 +0900)
src/udev/udev-builtin-net_id.c

index 66c52e624cd8db9536a26e7bf1e4cfa307c20412..53653c492a827885994fa75eb0a25a2fb509030b 100644 (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 &&