diff options
author | Daniel Henrique Barboza <danielhb413@gmail.com> | 2022-03-02 06:51:40 +0100 |
---|---|---|
committer | Cédric Le Goater <clg@kaod.org> | 2022-03-02 06:51:40 +0100 |
commit | 169518430562b454a1531610d2711c6b920929f6 (patch) | |
tree | a951bb663225ffa4a1193d6c9d619483f988e732 /hw | |
parent | 3a1229148d3176bb3dbb1b0054da28400ab17694 (diff) | |
download | qemu-169518430562b454a1531610d2711c6b920929f6.zip qemu-169518430562b454a1531610d2711c6b920929f6.tar.gz qemu-169518430562b454a1531610d2711c6b920929f6.tar.bz2 |
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')
-rw-r--r-- | hw/ppc/spapr_vio.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index b975ed2..9d4fec2 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); } |