aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlison Schofield <alison.schofield@intel.com>2022-03-03 17:36:43 -0800
committerVishal Verma <vishal.l.verma@intel.com>2022-03-04 01:08:07 -0700
commit7564aeeae7bc8c3813bd80676769bd11a1055ca0 (patch)
treeb7731dfb5a75654ee0492df1f218897e6ad293ee
parent367593e7b602fd490baf22a26887c09877e75c14 (diff)
cxl/list: always free the path var in add_cxl_decoder()
Static analysis reported a resource leak where the 'path' variable was not always freed before returns. Link: https://lore.kernel.org/r/20220304013643.1054605-1-alison.schofield@intel.com Fixes: 46564977afb7 ("cxl/list: Add decoder support") Signed-off-by: Alison Schofield <alison.schofield@intel.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
-rw-r--r--cxl/lib/libcxl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
index 1782f423..59e16446 100644
--- a/cxl/lib/libcxl.c
+++ b/cxl/lib/libcxl.c
@@ -1018,11 +1018,13 @@ static void *add_cxl_decoder(void *parent, int id, const char *cxldecoder_base)
cxl_decoder_foreach(port, decoder_dup)
if (decoder_dup->id == decoder->id) {
free_decoder(decoder, NULL);
+ free(path);
return decoder_dup;
}
list_add(&port->decoders, &decoder->list);
+ free(path);
return decoder;
err_decoder: