[PATCH 19/28] domain_conf: use g_free in virDomainDiskSetBlockIOTune()

Ján Tomko jtomko at redhat.com
Thu Nov 12 15:46:18 UTC 2020


On a Thursday in 2020, Matt Coleman wrote:
>Signed-off-by: Matt Coleman <matt at datto.com>
>---
> src/conf/domain_conf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 25baa44a92..d71bd68682 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -31972,7 +31972,7 @@ virDomainDiskSetBlockIOTune(virDomainDiskDefPtr disk,
>
>     tmp_group = g_strdup(info->group_name);
>

The tmp_group variable is not needed here. It's an artifact from back
when strdup could fail, to avoid the situation of freeing the old group
name without being able to copy the new one.

Jano

>-    VIR_FREE(disk->blkdeviotune.group_name);
>+    g_free(disk->blkdeviotune.group_name);
>     disk->blkdeviotune = *info;
>     disk->blkdeviotune.group_name = g_steal_pointer(&tmp_group);
> }
>-- 
>2.27.0
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201112/7c48fd80/attachment-0001.sig>


More information about the libvir-list mailing list