commit 01ffcb46259205fe4a9b49aecc8888253dfbf7a2
Author: Tomas Bzatek <tbzatek@redhat.com>
Date: Wed Mar 23 13:17:02 2022 +0100
tree: Handle NULL subsysname in nvme_scan_ctrl()
As noted couple of lines earlier, the subsysname string might
be NULL. In that case, defer initialization of nvme_subsystem_t
in hope that it would get initialized while scanning subsystems.
diff --git a/src/nvme/tree.c b/src/nvme/tree.c
index 0764690..5042a8e 100644
--- a/src/nvme/tree.c
+++ b/src/nvme/tree.c
@@ -1367,7 +1367,7 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name)
free(subsysnqn);
ret = 0;
- if (s && !s->name)
+ if (s && !s->name && subsysname)
ret = nvme_init_subsystem(s, subsysname);
free(subsysname);
if (!s || ret < 0) {