diff mbox

[08/11] ndctl: unreference dimm kmod_module during free_bus

Message ID 20150905013158.28464.65681.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 380a277b02f2
Headers show

Commit Message

Dan Williams Sept. 5, 2015, 1:31 a.m. UTC
From: Nicholas Moulin <nicholas.w.moulin@intel.com>

We were leaking memory every time a ndctl ctx was created and released
due to the dimm kmodule not being released when the bus was free

Signed-off-by: Nicholas Moulin <nicholas.w.moulin@intel.com>
Tested-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 lib/libndctl.c |    1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/lib/libndctl.c b/lib/libndctl.c
index d85453a3ac63..5de7359f1cc5 100644
--- a/lib/libndctl.c
+++ b/lib/libndctl.c
@@ -584,6 +584,7 @@  static void free_bus(struct ndctl_bus *bus)
 		list_del_from(&bus->dimms, &dimm->list);
 		free(dimm->dimm_path);
 		free(dimm->dimm_buf);
+		kmod_module_unref(dimm->module);
 		free(dimm);
 	}
 	list_for_each_safe(&bus->regions, region, _r, list)