Skip to content

fabrics: fix mem leak at nvmf_connect()#3068

Merged
igaw merged 1 commit intolinux-nvme:masterfrom
martin-gpy:nvmf_connect_mem_leak
Jan 21, 2026
Merged

fabrics: fix mem leak at nvmf_connect()#3068
igaw merged 1 commit intolinux-nvme:masterfrom
martin-gpy:nvmf_connect_mem_leak

Conversation

@martin-gpy
Copy link
Contributor

Valgrind revealed a mem leak if nvme_add_ctrl() returns with an error in nvmf_connect():

==22187== 467 (344 direct, 123 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 6
==22187== at 0x4848C31: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22187== by 0x4887F03: nvme_create_ctrl (tree.c:1454)
==22187== by 0x487CCA2: nvmf_connect (fabrics.c:3396)
==22187== by 0x40A584: fabrics_connect (fabrics.c:681)
==22187== by 0x445E28: handle_plugin (plugin.c:190)
==22187== by 0x407680: main (nvme.c:11085)

Fix the same.

Valgrind revealed a mem leak if nvme_add_ctrl() returns with an
error in nvmf_connect():

==22187== 467 (344 direct, 123 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 6
==22187==    at 0x4848C31: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22187==    by 0x4887F03: nvme_create_ctrl (tree.c:1454)
==22187==    by 0x487CCA2: nvmf_connect (fabrics.c:3396)
==22187==    by 0x40A584: fabrics_connect (fabrics.c:681)
==22187==    by 0x445E28: handle_plugin (plugin.c:190)
==22187==    by 0x407680: main (nvme.c:11085)

Fix the same.

Signed-off-by: Martin George <marting@netapp.com>
@igaw igaw merged commit 5fd3e9b into linux-nvme:master Jan 21, 2026
19 of 20 checks passed
@igaw
Copy link
Collaborator

igaw commented Jan 21, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants