libcxl: Fix memory leakage in cxl_port_init()
PATCH 1/1 libcxl: Fix memory leakage in cxl_port_init()
The local variable 'path' is not freed in cxl_port_init() for success case. The patch fixes that.
Signed-off-by Shivaprasad G Bhat <[email protected]>
--- cxl/lib/libcxl.c | 1 + 1 file changed, 1 insertion(+)
cxl/lib/libcxl.c +1 -0
@@ -770,6 +770,7 @@ static int cxl_port_init(struct cxl_port *port, struct cxl_port *parent_port,if (sysfs_read_attr (ctx, path, buf) ==0 ) port->module =util_modalias_to_module (ctx, buf); +free (path);return 0 ; err:free (port->dev_path);
Quoted 2 lines · Shivaprasad G Bhat
The local variable 'path' is not freed in
cxl_port_init()for success case. The patch fixes that.
Looks good,
Reviewed-by Dan Williams <[email protected]>
Quoted 17 lines · Shivaprasad G Bhat
The local variable 'path' is not freed in
cxl_port_init()for success case.
The patch fixes that.Signed-off-by Shivaprasad G Bhat <[email protected]>---
cxl/lib/libcxl.c | 1 +1 file changed, 1 insertion(+)cxl/lib/libcxl.c +0
-0@@ -770,6 +770,7 @@ static int cxl_port_init(struct cxl_port *port,struct cxl_port *parent_port, if (sysfs_read_attr(ctx, path, buf) == 0) port->module = util_modalias_to_module(ctx, buf);
Quoted 7 lines
+ free(path);
return 0;
err:
free(port->dev_path);
Thanks, applied.
Just a quick note to CC [email protected] for CXL related patches, and use "ndctl PATCH" as the subject prefix.