Re: [Qemu-devel] [PATCH v2] qpci_free_pc: sdhci-test and vhost-user-test could free() NULL pointers.

2018-07-02 Thread Emanuele
On 07/02/2018 04:35 PM, Paolo Bonzini wrote: On 02/07/2018 16:05, Emanuele Giuseppe Esposito wrote: @@ -152,6 +152,8 @@ QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc) void qpci_free_pc(QPCIBus *bus) { +g_assert(bus); + QPCIBusPC *s = container_of(bus,

Re: [Qemu-devel] [PATCH v2] qpci_free_pc: sdhci-test and vhost-user-test could free() NULL pointers.

2018-07-02 Thread Paolo Bonzini
On 02/07/2018 16:05, Emanuele Giuseppe Esposito wrote: > @@ -152,6 +152,8 @@ QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator > *alloc) > > void qpci_free_pc(QPCIBus *bus) > { > +g_assert(bus); > + > QPCIBusPC *s = container_of(bus, QPCIBusPC, bus); > > g_free(s); > diff

[Qemu-devel] [PATCH v2] qpci_free_pc: sdhci-test and vhost-user-test could free() NULL pointers.

2018-07-02 Thread Emanuele Giuseppe Esposito
server->bus in _test_server_free() could be NULL, since TestServer *dest in test_migrate() was not properly initialized like TestServer *s. Added init_virtio_dev(dest) and uninit_virtio_dev(dest), so the fields are properly set and when test_server_free(dest); is called, they can be correctly