aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/dev-mtp.c
diff options
context:
space:
mode:
authorBandan Das <bsd@redhat.com>2015-12-23 14:39:46 +0530
committerGerd Hoffmann <kraxel@redhat.com>2016-01-08 09:25:50 +0100
commitc22d5dcd7a8ee8316dfbad66d13abb6d661c86b9 (patch)
tree742c95fbd48dbdc7fcd304a55ef9535461528dae /hw/usb/dev-mtp.c
parent0922c3f6064ebe4c65fd1190b014a742083b5906 (diff)
downloadqemu-c22d5dcd7a8ee8316dfbad66d13abb6d661c86b9.zip
qemu-c22d5dcd7a8ee8316dfbad66d13abb6d661c86b9.tar.gz
qemu-c22d5dcd7a8ee8316dfbad66d13abb6d661c86b9.tar.bz2
usb-mtp: use safe variant when cleaning events list
usb_mtp_inotify_cleanup uses QLIST_FOREACH to pick events from a list and free them which is incorrect. Use QLIST_FOREACH_SAFE instead. Signed-off-by: Bandan Das <bsd@redhat.com> Message-id: 1450861787-16213-2-git-send-email-bsd@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/dev-mtp.c')
-rw-r--r--hw/usb/dev-mtp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index af056c7..db1fd59 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -556,7 +556,7 @@ static int usb_mtp_inotify_init(MTPState *s)
static void usb_mtp_inotify_cleanup(MTPState *s)
{
- MTPMonEntry *e;
+ MTPMonEntry *e, *p;
if (!s->inotifyfd) {
return;
@@ -565,7 +565,7 @@ static void usb_mtp_inotify_cleanup(MTPState *s)
qemu_set_fd_handler(s->inotifyfd, NULL, NULL, s);
close(s->inotifyfd);
- QTAILQ_FOREACH(e, &s->events, next) {
+ QTAILQ_FOREACH_SAFE(e, &s->events, next, p) {
QTAILQ_REMOVE(&s->events, e, next);
g_free(e);
}