]> git.proxmox.com Git - mirror_qemu.git/commitdiff
usb-mtp: reset ObjectInfo dataset size on cleanup
authorBandan Das <bsd@redhat.com>
Fri, 7 Sep 2018 22:08:51 +0000 (18:08 -0400)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 1 Oct 2018 08:49:54 +0000 (10:49 +0200)
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>
hw/usb/dev-mtp.c

index 15edf3bb82991284477cb1220f6a2b40a8b766fa..00a3691bae987e6ba1e87772816e57707b3a6738 100644 (file)
@@ -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;
 }