Skip to content

Commit 96e9ac2

Browse files
martin-gpyigaw
authored andcommitted
tree: fix mem leak in list-subsys verbose option
Valgrind revealed a mem leak while running nvme list-subsys -vv: ==2486== 18 bytes in 1 blocks are still reachable in loss record 1 of 1 ==2486== at 0x4841984: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2486== by 0x4956037: __vasprintf_internal (in /lib64/libc.so.6) ==2486== by 0x49F73AE: __asprintf_chk (in /lib64/libc.so.6) ==2486== by 0x49796FB: strerror_l (in /lib64/libc.so.6) ==2486== by 0x488A4AF: nvme_scan_topology (tree.c:317) ==2486== by 0x42E3BC: list_subsys (nvme.c:3499) ==2486== by 0x445F88: handle_plugin (plugin.c:190) ==2486== by 0x407620: main (nvme.c:11119) Fix this by ensuring an appropriate value is passed to strerror(). Signed-off-by: Martin George <[email protected]>
1 parent 4b22004 commit 96e9ac2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libnvme/src/nvme/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ int nvme_scan_topology(struct nvme_global_ctx *ctx, nvme_scan_filter_t f, void *
316316
if (ret < 0) {
317317
nvme_msg(ctx, LOG_DEBUG,
318318
"failed to scan subsystem %s: %s\n",
319-
subsys.ents[i]->d_name, strerror(ret));
319+
subsys.ents[i]->d_name, strerror(-ret));
320320
}
321321
}
322322

0 commit comments

Comments
 (0)