summary refs log tree commit diff stats
path: root/hw/usb/dev-mtp.c
diff options
context:
space:
mode:
authorBandan Das <bsd@redhat.com>2018-09-07 18:08:51 -0400
committerGerd Hoffmann <kraxel@redhat.com>2018-10-01 10:49:54 +0200
commitf7c36a754c0a597e6c397e6e21e03798fc2eee69 (patch)
tree41b3de635e68c8c0f62482d2e6e83a69e2543b59 /hw/usb/dev-mtp.c
parent1ee53067f849506042193a9fd57f857583536eca (diff)
downloadfocaccia-qemu-f7c36a754c0a597e6c397e6e21e03798fc2eee69.tar.gz
focaccia-qemu-f7c36a754c0a597e6c397e6e21e03798fc2eee69.zip
usb-mtp: reset ObjectInfo dataset size on cleanup
Stale values in this field may result in qemu
expecting more data on the next operation

Signed-off-by: Bandan Das <bsd@redhat.com>
Message-id: 20180907220851.9658-4-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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 15edf3bb82..00a3691bae 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1568,6 +1568,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p,
             if (s->write_pending) {
                 g_free(s->dataset.filename);
                 s->write_pending = false;
+                s->dataset.size = 0;
             }
             usb_mtp_data_free(s->data_out);
             s->data_out = NULL;
@@ -1693,6 +1694,7 @@ done:
     }
 free:
     g_free(s->dataset.filename);
+    s->dataset.size = 0;
     g_free(path);
     s->write_pending = false;
 }