[libgpiod] [PATCH] gpioinfo: don't crash after EACCESS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If chip_open_by_name() fails then EACCESS is not treated as a fatal
error, but falling through calls list_lines(NULL) which leads to a
segfault.  Move on to the next chip in this instance.

Signed-off-by: John Keeping <john@xxxxxxxxxxxx>
---
 tools/gpioinfo.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/gpioinfo.c b/tools/gpioinfo.c
index d50af45..542a881 100644
--- a/tools/gpioinfo.c
+++ b/tools/gpioinfo.c
@@ -226,6 +226,9 @@ int main(int argc, char **argv)
 				else
 					die_perror("unable to open %s",
 						   entries[i]->d_name);
+
+				free(entries[i]);
+				continue;
 			}
 
 			list_lines(chip);
-- 
2.35.3




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux