[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen master] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event



commit f0dee5a40d27ad8ce2d180141bb5953fce44a146
Author:     David Hildenbrand <david@xxxxxxxxxx>
AuthorDate: Wed Sep 29 18:24:43 2021 +0200
Commit:     Michael Roth <michael.roth@xxxxxxx>
CommitDate: Tue Dec 14 08:56:49 2021 -0600

    virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE 
event
    
    Apparently, we don't have to duplicate the string.
    
    Fixes: 722a3c783ef4 ("virtio-pci: Send qapi events when the virtio-mem size 
changes")
    Cc: qemu-stable@xxxxxxxxxx
    Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
    Reviewed-by: Markus Armbruster <armbru@xxxxxxxxxx>
    Message-Id: <20210929162445.64060-2-david@xxxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    (cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4)
    Signed-off-by: Michael Roth <michael.roth@xxxxxxx>
---
 hw/virtio/virtio-mem-pci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c
index fa5395cd88..7e384b7397 100644
--- a/hw/virtio/virtio-mem-pci.c
+++ b/hw/virtio/virtio-mem-pci.c
@@ -88,13 +88,8 @@ static void virtio_mem_pci_size_change_notify(Notifier 
*notifier, void *data)
                                          size_change_notifier);
     DeviceState *dev = DEVICE(pci_mem);
     const uint64_t * const size_p = data;
-    const char *id = NULL;
 
-    if (dev->id) {
-        id = g_strdup(dev->id);
-    }
-
-    qapi_event_send_memory_device_size_change(!!id, id, *size_p);
+    qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p);
 }
 
 static void virtio_mem_pci_class_init(ObjectClass *klass, void *data)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.