From 91f7671ca54a200d652b9b9f34915325313511f5 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 3 May 2024 17:19:39 +0200 Subject: [PATCH] linux: Fix uninitialized variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from ../src/nvme/linux.c:40: In function ‘freep’, inlined from ‘nvme_get_telemetry_log’ at ../src/nvme/linux.c:169:23: ../src/nvme/cleanup.h:24:9: warning: ‘log’ may be used uninitialized [-Wmaybe-uninitialized] 24 | free(*(void **)p); | ^~~~~~~~~~~~~~~~~ ../src/nvme/linux.c: In function ‘nvme_get_telemetry_log’: ../src/nvme/linux.c:169:30: note: ‘log’ was declared here 169 | _cleanup_free_ void *log; | ^~~ Signed-off-by: Tomas Bzatek --- src/nvme/linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvme/linux.c b/src/nvme/linux.c index 25196fd5..35976011 100644 --- a/src/nvme/linux.c +++ b/src/nvme/linux.c @@ -166,7 +166,7 @@ int nvme_get_telemetry_log(int fd, bool create, bool ctrl, bool rae, size_t max_ struct nvme_telemetry_log *telem; enum nvme_cmd_get_log_lid lid; - _cleanup_free_ void *log; + _cleanup_free_ void *log = NULL; void *tmp; int err; size_t dalb; -- 2.44.0