diff options
author | David Hildenbrand <david@redhat.com> | 2021-09-29 18:24:43 +0200 |
---|---|---|
committer | Michael Roth <michael.roth@amd.com> | 2021-10-15 17:55:37 -0500 |
commit | 5a964fe8d93efd9c42c72a6244bd23039380eb59 (patch) | |
tree | 9ec5ea1a0a25e358a2889938702e4557be8f2190 | |
parent | f22c225e2359429508d65f581b9bdf457a0ac069 (diff) | |
download | qemu-5a964fe8d93efd9c42c72a6244bd23039380eb59.zip qemu-5a964fe8d93efd9c42c72a6244bd23039380eb59.tar.gz qemu-5a964fe8d93efd9c42c72a6244bd23039380eb59.tar.bz2 |
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@nongnu.org
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210929162445.64060-2-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4)
Signed-off-by: Michael Roth <michael.roth@amd.com>
-rw-r--r-- | hw/virtio/virtio-mem-pci.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index fa5395c..7e384b7 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) |