anitazha / rpms / ndctl

Forked from rpms/ndctl a year ago
Clone

Blame SOURCES/0174-libcxl-Fix-memory-leakage-in-cxl_port_init.patch

e0018b
From 29a9e9daa67e2b68bb2433c31fdbc82e86b5f0fe Mon Sep 17 00:00:00 2001
e0018b
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
e0018b
Date: Mon, 18 Jul 2022 13:53:35 +0530
e0018b
Subject: [PATCH 174/217] libcxl: Fix memory leakage in cxl_port_init()
e0018b
e0018b
The local variable 'path' is not freed in cxl_port_init() for success case.
e0018b
The patch fixes that.
e0018b
e0018b
Link: https://lore.kernel.org/r/165813258358.95191.6678871197554236554.stgit@LAPTOP-TBQTPII8
e0018b
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
---
e0018b
 cxl/lib/libcxl.c | 1 +
e0018b
 1 file changed, 1 insertion(+)
e0018b
e0018b
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
e0018b
index c988ce2..bf3568d 100644
e0018b
--- a/cxl/lib/libcxl.c
e0018b
+++ b/cxl/lib/libcxl.c
e0018b
@@ -769,6 +769,7 @@ static int cxl_port_init(struct cxl_port *port, struct cxl_port *parent_port,
e0018b
 	if (sysfs_read_attr(ctx, path, buf) == 0)
e0018b
 		port->module = util_modalias_to_module(ctx, buf);
e0018b
 
e0018b
+	free(path);
e0018b
 	return 0;
e0018b
 err:
e0018b
 	free(port->dev_path);
e0018b
-- 
e0018b
2.27.0
e0018b