From: Iker Pedrosa Date: Mon, 29 Jul 2024 10:57:19 +0000 (+0200) Subject: tools: fix a memory leak X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e7b40978801a6148cee75b10b9b775eba1b70a64;p=qemu-gpiodev%2Flibgpiod.git tools: fix a memory leak `info` variable is allocated, but never freed when the loop continues. Free it so that it isn't leaked. Signed-off-by: Iker Pedrosa Reviewed-by: Kent Gibson Link: https://lore.kernel.org/r/418b4fa7b6279b15ea10936d65ce45e01675e491.1722250385.git.ikerpedrosam@gmail.com Signed-off-by: Bartosz Golaszewski --- diff --git a/tools/gpioinfo.c b/tools/gpioinfo.c index 44d1c8c..d5e4751 100644 --- a/tools/gpioinfo.c +++ b/tools/gpioinfo.c @@ -195,8 +195,10 @@ static void list_lines(struct line_resolver *resolver, struct gpiod_chip *chip, offset, gpiod_chip_info_get_name(chip_info)); if (resolver->num_lines && - !resolve_line(resolver, info, chip_num)) + !resolve_line(resolver, info, chip_num)) { + gpiod_line_info_free(info); continue; + } if (resolver->num_lines) { printf("%s %u", gpiod_chip_info_get_name(chip_info),