We can return the formatted string directly. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3d136a6b8a..cfdd9270da 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11517,14 +11517,10 @@ char * qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk, unsigned int idx) { - char *ret = NULL; - if (idx) - ret = g_strdup_printf("%s[%d]", disk->dst, idx); + return g_strdup_printf("%s[%d]", disk->dst, idx); else - ret = g_strdup(disk->dst); - - return ret; + return g_strdup(disk->dst); } -- 2.26.2