Skip to content

Commit 2b4b321

Browse files
martin-gpyigaw
authored andcommitted
tree: fix mem leak in nvme_ns_init()
Valgrind revealed a mem leak in nvme_ns_init() invoked by several nvme commands such as connect-all, list, disconnect-all, etc. Leak traced to the nvme_ns_id pointer not getting freed after use. Fix the same. Signed-off-by: Martin George <[email protected]>
1 parent 93b2877 commit 2b4b321

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/nvme/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,7 @@ static int nvme_ns_init(const char *path, struct nvme_ns *ns)
24882488
if (ret)
24892489
return ret;
24902490
} else {
2491-
struct nvme_id_ns *id;
2491+
_cleanup_free_ struct nvme_id_ns *id = NULL;
24922492
uint8_t flbas;
24932493

24942494
id = __nvme_alloc(sizeof(*ns));

0 commit comments

Comments
 (0)