RE: [PATCH] drivers: nvdimm: fix memleak

From: Dan Williams
Date: Thu Aug 17 2023 - 11:07:12 EST


[ add Kajol and Madhavan ]

Konstantin Meskhidze wrote:
> Memory pointed by 'nd_pmu->pmu.attr_groups' is allocated in function
> 'register_nvdimm_pmu' and is lost after 'kfree(nd_pmu)' call in function
> 'unregister_nvdimm_pmu'.

Yes, looks like a real issue, but also completely avoidable by using statically
defined groups.

My fault for not catching this earlier, but Kajol, why is nd_perf not using
statically defined sysfs attribute groups?