Skip to content

Commit

Permalink
tree: do no free ns on error in nvme_ns_init
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
igaw committed Dec 20, 2023
1 parent 1df14d8 commit e2f2976
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,7 @@ static int nvme_ns_init(const char *path, struct nvme_ns *ns)

ret = nvme_ns_identify(ns, id);
if (ret)
free(ns);
return ret;

nvme_id_ns_flbas_to_lbaf_inuse(id->flbas, &flbas);
ns->lba_count = le64_to_cpu(id->nsze);
Expand Down

0 comments on commit e2f2976

Please sign in to comment.