summaryrefslogtreecommitdiffstats
path: root/hw/ppc
diff options
context:
space:
mode:
authorDaniel Henrique Barboza2022-03-02 06:51:40 +0100
committerCédric Le Goater2022-03-02 06:51:40 +0100
commit169518430562b454a1531610d2711c6b920929f6 (patch)
treea951bb663225ffa4a1193d6c9d619483f988e732 /hw/ppc
parenthw/ppc/spapr_rtas.c: use g_autofree in rtas_ibm_get_system_parameter() (diff)
downloadqemu-169518430562b454a1531610d2711c6b920929f6.tar.gz
qemu-169518430562b454a1531610d2711c6b920929f6.tar.xz
qemu-169518430562b454a1531610d2711c6b920929f6.zip
hw/ppc/spapr_vio.c: use g_autofree in spapr_dt_vdevice()
And return the result of g_strdup_printf() directly instead of using the 'path' var. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220228175004.8862-15-danielhb413@gmail.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/spapr_vio.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index b975ed29ca..9d4fec2c04 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -726,7 +726,7 @@ void spapr_dt_vdevice(SpaprVioBus *bus, void *fdt)
gchar *spapr_vio_stdout_path(SpaprVioBus *bus)
{
SpaprVioDevice *dev;
- char *name, *path;
+ g_autofree char *name = NULL;
dev = spapr_vty_get_default(bus);
if (!dev) {
@@ -734,8 +734,6 @@ gchar *spapr_vio_stdout_path(SpaprVioBus *bus)
}
name = spapr_vio_get_dev_name(DEVICE(dev));
- path = g_strdup_printf("/vdevice/%s", name);
- g_free(name);
- return path;
+ return g_strdup_printf("/vdevice/%s", name);
}