From fe4f622217991a12b31df1ea509f78bee4c567c1 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 29 Dec 2023 18:49:36 +0100 Subject: [PATCH] tree: Explicitly initialize auto-cleanup variables gcc complains about potentially uninitialized variables. Signed-off-by: Tomas Bzatek --- src/nvme/tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nvme/tree.c b/src/nvme/tree.c index 07a3c532..97bd3ef4 100644 --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -122,7 +122,8 @@ static void cleanup_dirents(struct dirents *ents) nvme_host_t nvme_default_host(nvme_root_t r) { struct nvme_host *h; - _cleanup_free_ char *hostnqn, *hostid; + _cleanup_free_ char *hostnqn = NULL; + _cleanup_free_ char *hostid = NULL; hostnqn = nvmf_hostnqn_from_file(); if (!hostnqn) @@ -1853,7 +1854,7 @@ static nvme_ctrl_t nvme_ctrl_alloc(nvme_root_t r, nvme_subsystem_t s, nvme_ctrl_t c, p; _cleanup_free_ char *addr = NULL, *address = NULL; char *a, *e; - _cleanup_free_ char *transport; + _cleanup_free_ char *transport = NULL; char *traddr = NULL, *trsvcid = NULL; char *host_traddr = NULL, *host_iface = NULL; int ret;