aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorLi Qiang <liq3ea@163.com>2019-01-03 05:31:13 -0800
committerGerd Hoffmann <kraxel@redhat.com>2019-01-30 06:47:52 +0100
commit6e3c1a68f91d8de2a800d994edf0c9eedde6f090 (patch)
tree54697a0a1fea38de1ffd3862eca20bbe0651e6c4 /hw/usb
parentb63e10508bee7169cfc7022805638c7358feefb5 (diff)
downloadqemu-6e3c1a68f91d8de2a800d994edf0c9eedde6f090.zip
qemu-6e3c1a68f91d8de2a800d994edf0c9eedde6f090.tar.gz
qemu-6e3c1a68f91d8de2a800d994edf0c9eedde6f090.tar.bz2
usb: dev-mtp: close fd in usb_mtp_object_readdir()
Spotted by Coverity: CID 1397070 Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20190103133113.49599-1-liq3ea@163.com [ 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 <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/dev-mtp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 68c5eb8..837c9d9 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