qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] usb: dev-mtp: close fd in usb_mtp_object_readdir()
@ 2019-01-03 13:31 Li Qiang
  2019-01-03 13:45 ` Philippe Mathieu-Daudé
  2019-01-07 10:22 ` Gerd Hoffmann
  0 siblings, 2 replies; 5+ messages in thread
From: Li Qiang @ 2019-01-03 13:31 UTC (permalink / raw)
  To: kraxel; +Cc: qemu-devel, peter.maydell, Li Qiang

Spotted by Coverity: CID 1397070

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 hw/usb/dev-mtp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index b19b576278..666bafd9e8 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
@@ -682,6 +683,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)
         usb_mtp_add_child(s, o, entry->d_name);
     }
     closedir(dir);
+    close(fd);
 }
 
 /* ----------------------------------------------------------------------- */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-11 10:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-03 13:31 [Qemu-devel] [PATCH] usb: dev-mtp: close fd in usb_mtp_object_readdir() Li Qiang
2019-01-03 13:45 ` Philippe Mathieu-Daudé
2019-01-07 10:22 ` Gerd Hoffmann
2019-01-07 10:35   ` Peter Maydell
2019-01-11 10:50     ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).