Skip to content

Commit

Permalink
linux: Fix uninitialized variables
Browse files Browse the repository at this point in the history
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 <tbzatek@redhat.com>
  • Loading branch information
tbzatek authored and igaw committed May 10, 2024
1 parent 7b24e80 commit 06b8853
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvme/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 06b8853

Please sign in to comment.