The ns pointer is owned by the caller not by nvme_ns_init, thus we can't
just free it on error.
Fixes: 7959f52960fd ("tree: read all attributes from sysfs when available")
Reported-by: Tomasz Kłoczko <kloczek@fedoraproject.org>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
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);