ieee1275: Fix crash in of_path_of_nvme when of_path is empty
[grub.git] / grub-core / osdep / linux / ofpath.c
index 1c30e72..6180621 100644 (file)
@@ -389,8 +389,11 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)),
     }
 
   of_path = find_obppath (sysfs_path);
+
+  if (of_path)
+    strcat (of_path, disk);
+
   free (sysfs_path);
-  strcat (of_path, disk);
   return of_path;
 }