cxl/list: always free the path var in add_cxl_decoder()
[email protected]
maintainerPATCH 1/1 cxl/list: always free the path var in add_cxl_decoder()
From: Alison Schofield <[email protected]>
Static analysis reported a resource leak where the 'path' variable was not always freed before returns.
Fixes 46564977afb7 ("cxl/list: Add decoder support")
Signed-off-by Alison Schofield <[email protected]>
--- cxl/lib/libcxl.c | 2 ++ 1 file changed, 2 insertions(+)
cxl/lib/libcxl.c +2 -0
@@ -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:free (decoder->dev_path);
base-commit: 3b5fb8b6428dfaab39bab58d67412427f514c1f4
Signature · 1 line
2.31.1