Message ID | 165813258358.95191.6678871197554236554.stgit@LAPTOP-TBQTPII8 (mailing list archive) |
---|---|
State | Accepted |
Commit | 29a9e9daa67e2b68bb2433c31fdbc82e86b5f0fe |
Headers | show |
Series | libcxl: Fix memory leakage in cxl_port_init() | expand |
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>
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.
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);
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(+)