From: Hewenliang Date: Sat, 26 Oct 2019 01:35:55 +0000 (-0400) Subject: tools: PCI: Fix fd leakage X-Git-Tag: v5.10.7~3719^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c379a59b4795d7279d38c623e74b9790345a32b;p=platform%2Fkernel%2Flinux-rpi.git tools: PCI: Fix fd leakage We should close fd before the return of run_test. Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Hewenliang Signed-off-by: Lorenzo Pieralisi Acked-by: Kishon Vijay Abraham I --- diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index cb1e51f..32b7c6f 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -129,6 +129,7 @@ static int run_test(struct pci_test *test) } fflush(stdout); + close(fd); return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */ }