Skip to content

Commit 09391da

Browse files
dwsuseigaw
authored andcommitted
tree: do no free ns on error in nvme_ns_init
The ns pointer is owned by the caller not by nvme_ns_init, thus we can't just free it on error. Fixes: 7959f52 ("tree: read all attributes from sysfs when available") Reported-by: Tomasz Kłoczko <[email protected]> Signed-off-by: Daniel Wagner <[email protected]>
1 parent 142d3c9 commit 09391da

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
@@ -2473,7 +2473,7 @@ static int nvme_ns_init(const char *path, struct nvme_ns *ns)
24732473

24742474
ret = nvme_ns_identify(ns, id);
24752475
if (ret)
2476-
free(ns);
2476+
return ret;
24772477

24782478
nvme_id_ns_flbas_to_lbaf_inuse(id->flbas, &flbas);
24792479
ns->lba_count = le64_to_cpu(id->nsze);

0 commit comments

Comments
 (0)