From 47cac92ca26c6c10d8319ab2c60ee126dee4b292 Mon Sep 17 00:00:00 2001 From: Volkan Unal Date: Wed, 4 Feb 2026 12:48:14 +0000 Subject: [PATCH] lscss: Fix memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the subchannel type read from sysfs does not match the requested type, the allocated path is not freed before continuing to the next loop iteration. This causes a memory leak as reported by valgrind. Free the path before continuing. Signed-off-by: Volkan Unal Reviewed-by: Vineeth Vijayan Signed-off-by: Jan Höppner --- zconf/css/lscss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zconf/css/lscss.c b/zconf/css/lscss.c index f09b5665..8c2d1437 100644 --- a/zconf/css/lscss.c +++ b/zconf/css/lscss.c @@ -701,8 +701,10 @@ static void print_subchannels_of_type(enum sch_type type_requested, sch_dir = de_vec[i]->d_name; path = util_path_sysfs("bus/css/devices/%s", sch_dir); if (util_file_read_ul(&type_ul, 10, "%s/type", path) == 0) { - if (type_ul != type_requested) + if (type_ul != type_requested) { + free(path); continue; + } if (type_ul == SUBCHANNEL_TYPE_IO) print_sch_io(rec, path, sch_dir); else if (type_ul == SUBCHANNEL_TYPE_CHSC)