Skip to content

Commit 5fd3e9b

Browse files
martin-gpyigaw
authored andcommitted
fabrics: fix mem leak at nvmf_connect()
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 <[email protected]>
1 parent 9f84578 commit 5fd3e9b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3419,6 +3419,7 @@ int nvmf_connect(struct nvme_global_ctx *ctx, struct nvmf_context *fctx)
34193419
if (err) {
34203420
nvme_msg(ctx, LOG_ERR, "could not add new controller: %s\n",
34213421
nvme_strerror(-err));
3422+
nvme_free_ctrl(c);
34223423
return err;
34233424
}
34243425

0 commit comments

Comments
 (0)