qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] core/qdev: fix memleak in qdev_get_gpio_out_connector()
@ 2020-03-07  3:07 Pan Nengyuan
  2020-03-07  3:16 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pan Nengyuan @ 2020-03-07  3:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: berrange, ehabkost, qemu-trivial, Pan Nengyuan, euler.robot,
	pbonzini, zhang.zhanghailiang

Fix a memory leak in qdev_get_gpio_out_connector().

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
 hw/core/qdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 3937d1eb1a..85f062def7 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -557,7 +557,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
 
 qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
 {
-    char *propname = g_strdup_printf("%s[%d]",
+    g_autofree char *propname = g_strdup_printf("%s[%d]",
                                      name ? name : "unnamed-gpio-out", n);
 
     qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
-- 
2.18.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-03-09 12:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-07  3:07 [PATCH] core/qdev: fix memleak in qdev_get_gpio_out_connector() Pan Nengyuan
2020-03-07  3:16 ` no-reply
2020-03-07 10:39 ` Marc-André Lureau
2020-03-09  9:16   ` Laurent Vivier
2020-03-09 10:41     ` Pan Nengyuan
2020-03-09 10:49       ` Laurent Vivier
2020-03-09 10:48     ` Daniel P. Berrangé
2020-03-09 12:05 ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).