[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] usb: dev-mtp: close fd in usb_mtp_object_readdir()
From: |
Li Qiang |
Subject: |
[Qemu-devel] [PATCH] usb: dev-mtp: close fd in usb_mtp_object_readdir() |
Date: |
Thu, 3 Jan 2019 05:31:13 -0800 |
Spotted by Coverity: CID 1397070
Signed-off-by: Li Qiang <address@hidden>
---
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
- [Qemu-devel] [PATCH] usb: dev-mtp: close fd in usb_mtp_object_readdir(),
Li Qiang <=