[libvirt PATCH 2/4] xenParseHypervisorFeatures: Remove superfluous VIR_FREE

Tim Wiederhake posted 4 patches 4 years, 9 months ago
[libvirt PATCH 2/4] xenParseHypervisorFeatures: Remove superfluous VIR_FREE
Posted by Tim Wiederhake 4 years, 9 months ago
Fixes: 4eb7c621985dad4de911ec394ac628bd1a5b29ab
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/libxl/xen_common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 6fa69fbdf0..aeb94e12ad 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -568,7 +568,6 @@ xenParseHypervisorFeatures(virConf *conf, virDomainDef *def)
             timer->mode = VIR_DOMAIN_TIMER_MODE_PARAVIRT;
 
         def->clock.timers[def->clock.ntimers - 1] = timer;
-        VIR_FREE(tscmode);
     }
 
     if (xenConfigGetString(conf, "passthrough", &passthrough, NULL) < 0)
-- 
2.26.3

Re: [libvirt PATCH 2/4] xenParseHypervisorFeatures: Remove superfluous VIR_FREE
Posted by Michal Privoznik 4 years, 9 months ago
On 4/20/21 1:27 PM, Tim Wiederhake wrote:
> Fixes: 4eb7c621985dad4de911ec394ac628bd1a5b29ab
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>   src/libxl/xen_common.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
> index 6fa69fbdf0..aeb94e12ad 100644
> --- a/src/libxl/xen_common.c
> +++ b/src/libxl/xen_common.c
> @@ -568,7 +568,6 @@ xenParseHypervisorFeatures(virConf *conf, virDomainDef *def)
>               timer->mode = VIR_DOMAIN_TIMER_MODE_PARAVIRT;
>   
>           def->clock.timers[def->clock.ntimers - 1] = timer;
> -        VIR_FREE(tscmode);
>       }
>   
>       if (xenConfigGetString(conf, "passthrough", &passthrough, NULL) < 0)
> 

That's not the only problem with the function. The pattern above in that 
if() you're fixing looks funny too:


if (tscmode) {
   ...
   STREQ_NULLABLE(tscmode, ...);
   ...
}

We know that @tscmode is not NULL when we're in the body.

Michal