qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 2/8] usb: dev-mtp: close fd in usb_mtp_object_readdir


From: Gerd Hoffmann
Subject: [Qemu-devel] [PULL 2/8] usb: dev-mtp: close fd in usb_mtp_object_readdir()
Date: Wed, 30 Jan 2019 08:34:20 +0100

From: Li Qiang <address@hidden>

Spotted by Coverity: CID 1397070

Signed-off-by: Li Qiang <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden

[ kraxel: dropped chunk which adds close() after successful
          fdopendir() call, that is not needed according to
          POSIX even though Coverity flags it as bug ]

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 hw/usb/dev-mtp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 68c5eb8eaa..837c9d9449 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -666,6 +666,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject 
*o)
     }
     dir = fdopendir(fd);
     if (!dir) {
+        close(fd);
         return;
     }
 #ifdef CONFIG_INOTIFY1
-- 
2.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]