Re: [libvirt PATCH 03/10] util: vircgroup: change virCgroupFree to take only virCgroupPtr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu,  8 Oct 2020 16:26:56 +0200
Pavel Hrdina <phrdina@xxxxxxxxxx> wrote:

> As preparation for g_autoptr() we need to change the function to take
> only virCgroupPtr.
> 
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  src/libvirt-lxc.c                 |  4 +-
>  src/lxc/lxc_cgroup.c              |  4 +-
>  src/lxc/lxc_container.c           |  2 +-
>  src/lxc/lxc_controller.c          |  2 +-
>  src/lxc/lxc_domain.c              |  2 +-
>  src/lxc/lxc_process.c             | 11 +++---
>  src/qemu/qemu_cgroup.c            | 12 +++---
>  src/qemu/qemu_domain.c            |  3 +-
>  src/qemu/qemu_driver.c            | 32 +++++++--------
>  src/qemu/qemu_process.c           |  2 +-
>  src/util/vircgroup.c              | 65
> +++++++++++++++++-------------- src/util/vircgroup.h              |
> 2 +- src/util/vircgroupv1.c            |  2 +-
>  tests/vircgrouptest.c             | 48 +++++++++++------------
>  tools/virt-host-validate-common.c |  2 +-
>  15 files changed, 102 insertions(+), 91 deletions(-)
> 
> diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c
> index 25f1cfc5f7..73daf123f0 100644
> --- a/src/libvirt-lxc.c
> +++ b/src/libvirt-lxc.c
> @@ -307,12 +307,12 @@ int virDomainLxcEnterCGroup(virDomainPtr domain,
>      if (virCgroupAddProcess(cgroup, getpid()) < 0)
>          goto error;
>  
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>  
>      return 0;
>  
>   error:
>      virDispatchError(NULL);
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return -1;
>  }
> diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
> index d13f2adde5..b80a8911f9 100644
> --- a/src/lxc/lxc_cgroup.c
> +++ b/src/lxc/lxc_cgroup.c
> @@ -168,7 +168,7 @@ int virLXCCgroupGetMeminfo(virLXCMeminfoPtr
> meminfo) 
>      ret = 0;
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -417,7 +417,7 @@ virCgroupPtr virLXCCgroupCreate(virDomainDefPtr
> def, def->idmap.uidmap[0].target,
>                                def->idmap.gidmap[0].target,
>                                (1 << VIR_CGROUP_CONTROLLER_SYSTEMD))
> < 0) {
> -            virCgroupFree(&cgroup);
> +            virCgroupFree(cgroup);
>              return NULL;
>          }
>      }
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index d1aa622be4..913f4de26a 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -1668,7 +1668,7 @@ static int
> lxcContainerSetupPivotRoot(virDomainDefPtr vmDef, ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
> index f70731bc64..e6dee85ec7 100644
> --- a/src/lxc/lxc_controller.c
> +++ b/src/lxc/lxc_controller.c
> @@ -310,7 +310,7 @@ static void
> virLXCControllerFree(virLXCControllerPtr ctrl) g_free(ctrl->nbdpids);
>  
>      g_free(ctrl->nsFDs);
> -    virCgroupFree(&ctrl->cgroup);
> +    virCgroupFree(ctrl->cgroup);
>  
>      /* This must always be the last thing to be closed */
>      VIR_FORCE_CLOSE(ctrl->handshakeFd);
> diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
> index d8aebe06d9..df60519fca 100644
> --- a/src/lxc/lxc_domain.c
> +++ b/src/lxc/lxc_domain.c
> @@ -168,7 +168,7 @@ virLXCDomainObjPrivateFree(void *data)
>  {
>      virLXCDomainObjPrivatePtr priv = data;
>  
> -    virCgroupFree(&priv->cgroup);
> +    virCgroupFree(priv->cgroup);
>      virLXCDomainObjFreeJob(priv);
>      g_free(priv);
>  }
> diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
> index 16969dbf33..a98a090893 100644
> --- a/src/lxc/lxc_process.c
> +++ b/src/lxc/lxc_process.c
> @@ -236,7 +236,8 @@ static void virLXCProcessCleanup(virLXCDriverPtr
> driver, 
>      if (priv->cgroup) {
>          virCgroupRemove(priv->cgroup);
> -        virCgroupFree(&priv->cgroup);
> +        virCgroupFree(priv->cgroup);
> +        priv->cgroup = NULL;
>      }
>  
>      /* Get machined to terminate the machine as it may not have
> cleaned it @@ -1202,26 +1203,26 @@ int
> virLXCProcessStart(virConnectPtr conn, 
>      if (!virCgroupHasController(selfcgroup,
>                                  VIR_CGROUP_CONTROLLER_CPUACCT)) {
> -        virCgroupFree(&selfcgroup);
> +        virCgroupFree(selfcgroup);
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                         _("Unable to find 'cpuacct' cgroups
> controller mount")); return -1;
>      }
>      if (!virCgroupHasController(selfcgroup,
>                                  VIR_CGROUP_CONTROLLER_DEVICES)) {
> -        virCgroupFree(&selfcgroup);
> +        virCgroupFree(selfcgroup);
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                         _("Unable to find 'devices' cgroups
> controller mount")); return -1;
>      }
>      if (!virCgroupHasController(selfcgroup,
>                                  VIR_CGROUP_CONTROLLER_MEMORY)) {
> -        virCgroupFree(&selfcgroup);
> +        virCgroupFree(selfcgroup);
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                         _("Unable to find 'memory' cgroups controller
> mount")); return -1;
>      }
> -    virCgroupFree(&selfcgroup);
> +    virCgroupFree(selfcgroup);
>  
>      if (vm->def->nconsoles == 0) {
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 9017753053..473ca8a414 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -921,7 +921,8 @@ qemuInitCgroup(virDomainObjPtr vm,
>      if (!virCgroupAvailable())
>          return 0;
>  
> -    virCgroupFree(&priv->cgroup);
> +    virCgroupFree(priv->cgroup);
> +    priv->cgroup = NULL;
>  
>      if (!vm->def->resource) {
>          virDomainResourceDefPtr res;
> @@ -983,7 +984,7 @@ qemuRestoreCgroupThread(virCgroupPtr cgroup,
>  
>      ret = 0;
>   cleanup:
> -    virCgroupFree(&cgroup_temp);
> +    virCgroupFree(cgroup_temp);
>      return ret;
>  }
>  
> @@ -1054,7 +1055,8 @@ qemuConnectCgroup(virDomainObjPtr vm)
>      if (!virCgroupAvailable())
>          return 0;
>  
> -    virCgroupFree(&priv->cgroup);
> +    virCgroupFree(priv->cgroup);
> +    priv->cgroup = NULL;
>  
>      if (virCgroupNewDetectMachine(vm->def->name,
>                                    "qemu",
> @@ -1150,7 +1152,7 @@ qemuSetupCgroupForExtDevices(virDomainObjPtr vm,
>      ret = qemuExtDevicesSetupCgroup(driver, vm, cgroup_temp);
>  
>   cleanup:
> -    virCgroupFree(&cgroup_temp);
> +    virCgroupFree(cgroup_temp);
>  
>      return ret;
>  }
> @@ -1221,7 +1223,7 @@
> qemuCgroupEmulatorAllNodesDataFree(qemuCgroupEmulatorAllNodesDataPtr
> data) if (!data) return;
>  
> -    virCgroupFree(&data->emulatorCgroup);
> +    virCgroupFree(data->emulatorCgroup);
>      VIR_FREE(data->emulatorMemMask);
>      VIR_FREE(data);
>  }
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 9623123d3c..2d7f61f5e9 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -1725,7 +1725,8 @@
> qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv)
> g_strfreev(priv->qemuDevices); priv->qemuDevices = NULL;
>  
> -    virCgroupFree(&priv->cgroup);
> +    virCgroupFree(priv->cgroup);
> +    priv->cgroup = NULL;
>  
>      virPerfFree(priv->perf);
>      priv->perf = NULL;
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 8ef812cd94..60e043115f 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -4583,7 +4583,7 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
>  
>   cleanup:
>      virBitmapFree(tmpmap);
> -    virCgroupFree(&cgroup_vcpu);
> +    virCgroupFree(cgroup_vcpu);
>      virObjectEventStateQueue(driver->domainEventState, event);
>      return ret;
>  }
> @@ -4809,7 +4809,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
>  
>   cleanup:
>      if (cgroup_emulator)
> -        virCgroupFree(&cgroup_emulator);
> +        virCgroupFree(cgroup_emulator);
>      virObjectEventStateQueue(driver->domainEventState, event);
>      virBitmapFree(pcpumap);
>      virDomainObjEndAPI(&vm);
> @@ -5287,7 +5287,7 @@ qemuDomainPinIOThread(virDomainPtr dom,
>  
>   cleanup:
>      if (cgroup_iothread)
> -        virCgroupFree(&cgroup_iothread);
> +        virCgroupFree(cgroup_iothread);
>      virObjectEventStateQueue(driver->domainEventState, event);
>      virBitmapFree(pcpumap);
>      virDomainObjEndAPI(&vm);
> @@ -8717,7 +8717,7 @@ qemuDomainSetNumaParamsLive(virDomainObjPtr vm,
>                             false, &cgroup_temp) < 0 ||
>          virCgroupSetCpusetMems(cgroup_temp, nodeset_str) < 0)
>          goto cleanup;
> -    virCgroupFree(&cgroup_temp);
> +    virCgroupFree(cgroup_temp);
>  
>      for (i = 0; i < virDomainDefGetVcpusMax(vm->def); i++) {
>          virDomainVcpuDefPtr vcpu = virDomainDefGetVcpu(vm->def, i);
> @@ -8729,7 +8729,7 @@ qemuDomainSetNumaParamsLive(virDomainObjPtr vm,
>                                 false, &cgroup_temp) < 0 ||
>              virCgroupSetCpusetMems(cgroup_temp, nodeset_str) < 0)
>              goto cleanup;
> -        virCgroupFree(&cgroup_temp);
> +        virCgroupFree(cgroup_temp);
>      }
>  
>      for (i = 0; i < vm->def->niothreadids; i++) {
> @@ -8738,7 +8738,7 @@ qemuDomainSetNumaParamsLive(virDomainObjPtr vm,
>                                 false, &cgroup_temp) < 0 ||
>              virCgroupSetCpusetMems(cgroup_temp, nodeset_str) < 0)
>              goto cleanup;
> -        virCgroupFree(&cgroup_temp);
> +        virCgroupFree(cgroup_temp);
>      }
>  
>      /* set nodeset for root cgroup */
> @@ -8747,7 +8747,7 @@ qemuDomainSetNumaParamsLive(virDomainObjPtr vm,
>  
>      ret = 0;
>   cleanup:
> -    virCgroupFree(&cgroup_temp);
> +    virCgroupFree(cgroup_temp);

I realize that this particular issue only exists until you switch to
using autoptr in patch 7, but you're technically introducing a bug
here. virCgroupFree() no longer clears the ptr to NULL, so when you
free cgroup_temp up above within this function, it is now a dangling
pointer, and then we try to free it again in the cleanup section.
Previously this cleanup call to virCgroupFree() was a no-op for all
non-error paths. 

There are several other examples within this patch.

>  
>      return ret;
>  }
> @@ -9164,13 +9164,13 @@ qemuSetVcpusBWLive(virDomainObjPtr vm,
> virCgroupPtr cgroup, if (qemuSetupCgroupVcpuBW(cgroup_vcpu, period,
> quota) < 0) goto cleanup;
>  
> -        virCgroupFree(&cgroup_vcpu);
> +        virCgroupFree(cgroup_vcpu);
>      }
>  
>      return 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup_vcpu);
> +    virCgroupFree(cgroup_vcpu);
>      return -1;
>  }
>  
> @@ -9191,11 +9191,11 @@ qemuSetEmulatorBandwidthLive(virCgroupPtr
> cgroup, if (qemuSetupCgroupVcpuBW(cgroup_emulator, period, quota) < 0)
>          goto cleanup;
>  
> -    virCgroupFree(&cgroup_emulator);
> +    virCgroupFree(cgroup_emulator);
>      return 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup_emulator);
> +    virCgroupFree(cgroup_emulator);
>      return -1;
>  }
>  
> @@ -9222,13 +9222,13 @@ qemuSetIOThreadsBWLive(virDomainObjPtr vm,
> virCgroupPtr cgroup, if (qemuSetupCgroupVcpuBW(cgroup_iothread,
> period, quota) < 0) goto cleanup;
>  
> -        virCgroupFree(&cgroup_iothread);
> +        virCgroupFree(cgroup_iothread);
>      }
>  
>      return 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup_iothread);
> +    virCgroupFree(cgroup_iothread);
>      return -1;
>  }
>  
> @@ -9601,7 +9601,7 @@ qemuGetVcpusBWLive(virDomainObjPtr vm,
>      ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup_vcpu);
> +    virCgroupFree(cgroup_vcpu);
>      return ret;
>  }
>  
> @@ -9624,7 +9624,7 @@ qemuGetEmulatorBandwidthLive(virCgroupPtr
> cgroup, ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup_emulator);
> +    virCgroupFree(cgroup_emulator);
>      return ret;
>  }
>  
> @@ -9660,7 +9660,7 @@ qemuGetIOThreadsBWLive(virDomainObjPtr vm,
>      ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup_iothread);
> +    virCgroupFree(cgroup_iothread);
>      return ret;
>  }
>  
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 6b5de29fdb..5bc76a75e3 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -2750,7 +2750,7 @@ qemuProcessSetupPid(virDomainObjPtr vm,
>      if (cgroup) {
>          if (ret < 0)
>              virCgroupRemove(cgroup);
> -        virCgroupFree(&cgroup);
> +        virCgroupFree(cgroup);
>      }
>  
>      return ret;
> diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
> index d52c0305f4..04876c6596 100644
> --- a/src/util/vircgroup.c
> +++ b/src/util/vircgroup.c
> @@ -680,7 +680,7 @@ virCgroupNew(pid_t pid,
>      return 0;
>  
>   error:
> -    virCgroupFree(group);
> +    virCgroupFree(*group);
>      *group = NULL;
>  
>      return -1;
> @@ -860,9 +860,11 @@ virCgroupNewPartition(const char *path,
>  
>      ret = 0;
>   cleanup:
> -    if (ret != 0)
> -        virCgroupFree(group);
> -    virCgroupFree(&parent);
> +    if (ret != 0) {
> +        virCgroupFree(*group);
> +        *group = NULL;
> +    }
> +    virCgroupFree(parent);
>      return ret;
>  }
>  
> @@ -923,7 +925,8 @@ virCgroupNewDomainPartition(virCgroupPtr
> partition, */
>      if (virCgroupMakeGroup(partition, *group, create,
>                             VIR_CGROUP_MEM_HIERACHY) < 0) {
> -        virCgroupFree(group);
> +        virCgroupFree(*group);
> +        *group = NULL;
>          return -1;
>      }
>  
> @@ -976,7 +979,8 @@ virCgroupNewThread(virCgroupPtr domain,
>          return -1;
>  
>      if (virCgroupMakeGroup(domain, *group, create,
> VIR_CGROUP_THREAD) < 0) {
> -        virCgroupFree(group);
> +        virCgroupFree(*group);
> +        *group = NULL;
>          return -1;
>      }
>  
> @@ -1019,7 +1023,8 @@ virCgroupNewDetectMachine(const char *name,
>                                                           machinename))
> { VIR_DEBUG("Failed to validate machine name for '%s' driver '%s'",
>                        name, drivername);
> -            virCgroupFree(group);
> +            virCgroupFree(*group);
> +            *group = NULL;
>              return 0;
>          }
>      }
> @@ -1059,13 +1064,13 @@ virCgroupEnableMissingControllers(char *path,
>              goto cleanup;
>  
>          if (virCgroupMakeGroup(parent, tmp, true,
> VIR_CGROUP_SYSTEMD) < 0) {
> -            virCgroupFree(&tmp);
> +            virCgroupFree(tmp);
>              goto cleanup;
>          }
>          if (t) {
>              *t = '/';
>              offset = t;
> -            virCgroupFree(&parent);
> +            virCgroupFree(parent);
>              parent = tmp;
>          } else {
>              *group = tmp;
> @@ -1075,7 +1080,7 @@ virCgroupEnableMissingControllers(char *path,
>  
>      ret = 0;
>   cleanup:
> -    virCgroupFree(&parent);
> +    virCgroupFree(parent);
>      return ret;
>  }
>  
> @@ -1130,7 +1135,7 @@ virCgroupNewMachineSystemd(const char *name,
>              break;
>          }
>      }
> -    virCgroupFree(&init);
> +    virCgroupFree(init);
>  
>      if (!path || STREQ(path, "/") || path[0] != '/') {
>          VIR_DEBUG("Systemd didn't setup its controller, path=%s",
> @@ -1148,7 +1153,8 @@ virCgroupNewMachineSystemd(const char *name,
>  
>          virErrorPreserveLast(&saved);
>          virCgroupRemove(*group);
> -        virCgroupFree(group);
> +        virCgroupFree(*group);
> +        *group = NULL;
>          virErrorRestore(&saved);
>      }
>  
> @@ -1199,7 +1205,8 @@ virCgroupNewMachineManual(const char *name,
>  
>          virErrorPreserveLast(&saved);
>          virCgroupRemove(*group);
> -        virCgroupFree(group);
> +        virCgroupFree(*group);
> +        *group = NULL;
>          virErrorRestore(&saved);
>      }
>  
> @@ -1207,7 +1214,7 @@ virCgroupNewMachineManual(const char *name,
>      ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&parent);
> +    virCgroupFree(parent);
>      return ret;
>  }
>  
> @@ -2059,12 +2066,12 @@ virCgroupGetPercpuVcpuSum(virCgroupPtr group,
>              sum_cpu_time[j] += tmp;
>          }
>  
> -        virCgroupFree(&group_vcpu);
> +        virCgroupFree(group_vcpu);
>      }
>  
>      ret = 0;
>   cleanup:
> -    virCgroupFree(&group_vcpu);
> +    virCgroupFree(group_vcpu);
>      return ret;
>  }
>  
> @@ -2556,7 +2563,7 @@ virCgroupKillRecursiveInternal(virCgroupPtr
> group, if (dormdir)
>              virCgroupRemove(subgroup);
>  
> -        virCgroupFree(&subgroup);
> +        virCgroupFree(subgroup);
>      }
>      if (direrr < 0)
>          goto cleanup;
> @@ -2565,7 +2572,7 @@ virCgroupKillRecursiveInternal(virCgroupPtr
> group, ret = killedAny ? 1 : 0;
>  
>   cleanup:
> -    virCgroupFree(&subgroup);
> +    virCgroupFree(subgroup);
>      VIR_DIR_CLOSE(dp);
>      return ret;
>  }
> @@ -2767,7 +2774,7 @@ virCgroupControllerAvailable(int controller)
>          return ret;
>  
>      ret = virCgroupHasController(cgroup, controller);
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -3534,24 +3541,24 @@ virCgroupControllerAvailable(int controller
> G_GNUC_UNUSED)
>   * @group: The group structure to free
>   */
>  void
> -virCgroupFree(virCgroupPtr *group)
> +virCgroupFree(virCgroupPtr group)
>  {
>      size_t i;
>  
> -    if (*group == NULL)
> +    if (group == NULL)
>          return;
>  
>      for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
> -        VIR_FREE((*group)->legacy[i].mountPoint);
> -        VIR_FREE((*group)->legacy[i].linkPoint);
> -        VIR_FREE((*group)->legacy[i].placement);
> +        VIR_FREE(group->legacy[i].mountPoint);
> +        VIR_FREE(group->legacy[i].linkPoint);
> +        VIR_FREE(group->legacy[i].placement);
>      }
>  
> -    VIR_FREE((*group)->unified.mountPoint);
> -    VIR_FREE((*group)->unified.placement);
> +    VIR_FREE(group->unified.mountPoint);
> +    VIR_FREE(group->unified.placement);
>  
> -    VIR_FREE((*group)->path);
> -    VIR_FREE(*group);
> +    VIR_FREE(group->path);
> +    VIR_FREE(group);
>  }
>  
>  
> @@ -3568,7 +3575,7 @@ virCgroupDelThread(virCgroupPtr cgroup,
>  
>          /* Remove the offlined cgroup */
>          virCgroupRemove(new_cgroup);
> -        virCgroupFree(&new_cgroup);
> +        virCgroupFree(new_cgroup);
>      }
>  
>      return 0;
> diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
> index 1dcd0688f1..691bec610f 100644
> --- a/src/util/vircgroup.h
> +++ b/src/util/vircgroup.h
> @@ -107,7 +107,7 @@ int virCgroupTerminateMachine(const char *name)
>  
>  bool virCgroupNewIgnoreError(void);
>  
> -void virCgroupFree(virCgroupPtr *group);
> +void virCgroupFree(virCgroupPtr group);
>  
>  bool virCgroupHasController(virCgroupPtr cgroup, int controller);
>  int virCgroupPathOfController(virCgroupPtr group,
> diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
> index 5504441fa6..52d2a17d39 100644
> --- a/src/util/vircgroupv1.c
> +++ b/src/util/vircgroupv1.c
> @@ -1484,7 +1484,7 @@ virCgroupV1MemoryOnceInit(void)
>                                        "memory.limit_in_bytes",
>                                        &mem_unlimited));
>   cleanup:
> -    virCgroupFree(&group);
> +    virCgroupFree(group);
>      virCgroupV1MemoryUnlimitedKB = mem_unlimited >> 10;
>  }
>  
> diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
> index e5be556104..632d33efcd 100644
> --- a/tests/vircgrouptest.c
> +++ b/tests/vircgrouptest.c
> @@ -217,7 +217,7 @@ testCgroupDetectMounts(const void *args)
>   cleanup:
>      g_unsetenv("VIR_CGROUP_MOCK_FILENAME");
>      VIR_FREE(parsed);
> -    virCgroupFree(&group);
> +    virCgroupFree(group);
>      return result;
>  }
>  
> @@ -245,7 +245,7 @@ static int testCgroupNewForSelf(const void *args
> G_GNUC_UNUSED) ret = validateCgroup(cgroup, "", mountsFull, links,
> placement, NULL, NULL, 0); 
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -322,7 +322,7 @@ static int testCgroupNewForPartition(const void
> *args G_GNUC_UNUSED) goto cleanup;
>      }
>      ret = validateCgroup(cgroup, "/virtualmachines.partition",
> mountsSmall, links, placementSmall, NULL, NULL, 0);
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>  
>      if ((rv = virCgroupNewPartition("/virtualmachines", true, -1,
> &cgroup)) != 0) { fprintf(stderr, "Cannot create /virtualmachines
> cgroup: %d\n", -rv); @@ -331,7 +331,7 @@ static int
> testCgroupNewForPartition(const void *args G_GNUC_UNUSED) ret =
> validateCgroup(cgroup, "/virtualmachines.partition", mountsFull,
> links, placementFull, NULL, NULL, 0); cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -371,7 +371,7 @@ static int testCgroupNewForPartitionNested(const
> void *args G_GNUC_UNUSED) }
>  
>      /* Should now work */
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      if ((rv = virCgroupNewPartition("/deployment/production", true,
> -1, &cgroup)) != 0) { fprintf(stderr, "Failed to create
> /deployment/production cgroup: %d\n", -rv); goto cleanup;
> @@ -381,7 +381,7 @@ static int testCgroupNewForPartitionNested(const
> void *args G_GNUC_UNUSED) mountsFull, links, placementFull, NULL,
> NULL, 0); 
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -420,14 +420,14 @@ static int
> testCgroupNewForPartitionNestedDeep(const void *args G_GNUC_UNUSED)
> goto cleanup; }
>  
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      if ((rv = virCgroupNewPartition("/user/berrange.user", true, -1,
> &cgroup)) != 0) { fprintf(stderr, "Failed to create
> /user/berrange.user cgroup: %d\n", -rv); goto cleanup;
>      }
>  
>      /* Should now work */
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      if ((rv =
> virCgroupNewPartition("/user/berrange.user/production", true, -1,
> &cgroup)) != 0) { fprintf(stderr, "Failed to create
> /user/berrange.user/production cgroup: %d\n", -rv); goto cleanup; @@
> -437,7 +437,7 @@ static int testCgroupNewForPartitionNestedDeep(const
> void *args G_GNUC_UNUSED) mountsFull, links, placementFull, NULL,
> NULL, 0); cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -473,8 +473,8 @@ static int testCgroupNewForPartitionDomain(const
> void *args G_GNUC_UNUSED) ret = validateCgroup(domaincgroup,
> "/production.partition/foo.libvirt-lxc", mountsFull, links,
> placement, NULL, NULL, 0); cleanup:
> -    virCgroupFree(&partitioncgroup);
> -    virCgroupFree(&domaincgroup);
> +    virCgroupFree(partitioncgroup);
> +    virCgroupFree(domaincgroup);
>      return ret;
>  }
>  
> @@ -524,10 +524,10 @@ static int
> testCgroupNewForPartitionDomainEscaped(const void *args G_GNUC_UNUSED
> ret = validateCgroup(domaincgroup,
> "/_cgroup.evil/net_cls.evil/__evil.evil/_cpu.foo.libvirt-lxc",
> mountsFull, links, placement, NULL, NULL, 0); cleanup:
> -    virCgroupFree(&partitioncgroup3);
> -    virCgroupFree(&partitioncgroup2);
> -    virCgroupFree(&partitioncgroup1);
> -    virCgroupFree(&domaincgroup);
> +    virCgroupFree(partitioncgroup3);
> +    virCgroupFree(partitioncgroup2);
> +    virCgroupFree(partitioncgroup1);
> +    virCgroupFree(domaincgroup);
>      return ret;
>  }
>  
> @@ -553,7 +553,7 @@ static int testCgroupNewForSelfAllInOne(const
> void *args G_GNUC_UNUSED) ret = validateCgroup(cgroup, "",
> mountsAllInOne, linksAllInOne, placement, NULL, NULL, 0); 
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -564,7 +564,7 @@ static int testCgroupNewForSelfLogind(const void
> *args G_GNUC_UNUSED) 
>      if (virCgroupNewSelf(&cgroup) >= 0) {
>          fprintf(stderr, "Expected to fail, only systemd cgroup
> available.\n");
> -        virCgroupFree(&cgroup);
> +        virCgroupFree(cgroup);
>          return -1;
>      }
>  
> @@ -592,7 +592,7 @@ static int testCgroupNewForSelfUnified(const void
> *args G_GNUC_UNUSED) ret = validateCgroup(cgroup, "", empty, empty,
> empty, "/not/really/sys/fs/cgroup", "/", controllers);
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -630,7 +630,7 @@ static int testCgroupNewForSelfHybrid(const void
> *args G_GNUC_UNUSED) "/not/really/sys/fs/cgroup/unified", "/",
> controllers); 
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -756,7 +756,7 @@ static int testCgroupGetPercpuStats(const void
> *args G_GNUC_UNUSED) ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      VIR_FREE(params);
>      return ret;
>  }
> @@ -789,7 +789,7 @@ static int testCgroupGetMemoryUsage(const void
> *args G_GNUC_UNUSED) ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -849,7 +849,7 @@ testCgroupGetMemoryStat(const void *args
> G_GNUC_UNUSED) ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -900,7 +900,7 @@ static int testCgroupGetBlkioIoServiced(const
> void *args G_GNUC_UNUSED) ret = 0;
>  
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> @@ -973,7 +973,7 @@ static int
> testCgroupGetBlkioIoDeviceServiced(const void *args G_GNUC_UNUSED)
> ret = 0; 
>   cleanup:
> -    virCgroupFree(&cgroup);
> +    virCgroupFree(cgroup);
>      return ret;
>  }
>  
> diff --git a/tools/virt-host-validate-common.c
> b/tools/virt-host-validate-common.c index c3784bb91d..4d8ec38f88
> 100644 --- a/tools/virt-host-validate-common.c
> +++ b/tools/virt-host-validate-common.c
> @@ -315,7 +315,7 @@ int virHostValidateCGroupControllers(const char
> *hvname, }
>      }
>  
> -    virCgroupFree(&group);
> +    virCgroupFree(group);
>  
>      return ret;
>  }




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux