All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libcxl: Fix memory leakage in cxl_port_init()
@ 2022-07-18  8:23 Shivaprasad G Bhat
  2022-07-18 19:21 ` Dan Williams
  2022-07-19  7:36 ` Verma, Vishal L
  0 siblings, 2 replies; 3+ messages in thread
From: Shivaprasad G Bhat @ 2022-07-18  8:23 UTC (permalink / raw)
  To: nvdimm, vishal.l.verma; +Cc: dan.j.williams, vaibhav, sbhat, aneesh.kumar

The local variable 'path' is not freed in cxl_port_init() for success case.
The patch fixes that.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
 cxl/lib/libcxl.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
index be6bc2c..e52896f 100644
--- a/cxl/lib/libcxl.c
+++ b/cxl/lib/libcxl.c
@@ -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);



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] libcxl: Fix memory leakage in cxl_port_init()
  2022-07-18  8:23 [PATCH] libcxl: Fix memory leakage in cxl_port_init() Shivaprasad G Bhat
@ 2022-07-18 19:21 ` Dan Williams
  2022-07-19  7:36 ` Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2022-07-18 19:21 UTC (permalink / raw)
  To: Shivaprasad G Bhat, nvdimm, vishal.l.verma
  Cc: dan.j.williams, vaibhav, sbhat, aneesh.kumar

Shivaprasad G Bhat wrote:
> The local variable 'path' is not freed in cxl_port_init() for success case.
> The patch fixes that.

Looks good,

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libcxl: Fix memory leakage in cxl_port_init()
  2022-07-18  8:23 [PATCH] libcxl: Fix memory leakage in cxl_port_init() Shivaprasad G Bhat
  2022-07-18 19:21 ` Dan Williams
@ 2022-07-19  7:36 ` Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Verma, Vishal L @ 2022-07-19  7:36 UTC (permalink / raw)
  To: sbhat, nvdimm; +Cc: Williams, Dan J, aneesh.kumar, linux-cxl, vaibhav

On Mon, 2022-07-18 at 13:53 +0530, Shivaprasad G Bhat wrote:
> The local variable 'path' is not freed in cxl_port_init() for success
> case.
> The patch fixes that.
> 
> Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
> ---
>  cxl/lib/libcxl.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
> index be6bc2c..e52896f 100644
> --- a/cxl/lib/libcxl.c
> +++ b/cxl/lib/libcxl.c
> @@ -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);
> 
> 

Thanks, applied.
Just a quick note to CC linux-cxl@vger.kernel.org for CXL related
patches, and use "ndctl PATCH" as the subject prefix.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-19  7:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18  8:23 [PATCH] libcxl: Fix memory leakage in cxl_port_init() Shivaprasad G Bhat
2022-07-18 19:21 ` Dan Williams
2022-07-19  7:36 ` Verma, Vishal L

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.