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

Re: [libvirt] [PATCH libvirt-python 06/17] Remove use of VIR_FREE from code



On Mon, Sep 09, 2013 at 05:01:37PM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> We don't have access to the libvirt memory APIs to replace
> VIR_FREE with free().

Wouldn't it be easier to port over VIR_FREE? It has some nice features
after all.
Cheers,
 -- Guido

> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  libvirt-lxc-override.c  |   4 +-
>  libvirt-override.c      | 228 ++++++++++++++++++++++++------------------------
>  libvirt-qemu-override.c |   4 +-
>  typewrappers.c          |   4 +-
>  4 files changed, 120 insertions(+), 120 deletions(-)
> 
> diff --git a/libvirt-lxc-override.c b/libvirt-lxc-override.c
> index 97d0353..03e3771 100644
> --- a/libvirt-lxc-override.c
> +++ b/libvirt-lxc-override.c
> @@ -90,14 +90,14 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self ATTRIBUTE_UNUSED,
>              goto error;
>          }
>      }
> -    VIR_FREE(fdlist);
> +    free(fdlist);
>      return py_retval;
>  
>  error:
>      for (i = 0; i < c_retval; i++) {
>          VIR_FORCE_CLOSE(fdlist[i]);
>      }
> -    VIR_FREE(fdlist);
> +    free(fdlist);
>      return VIR_PY_NONE;
>  }
>  /************************************************************************
> diff --git a/libvirt-override.c b/libvirt-override.c
> index 46cdd2f..70aaf24 100644
> --- a/libvirt-override.c
> +++ b/libvirt-override.c
> @@ -252,7 +252,7 @@ setPyVirTypedParameter(PyObject *info,
>      return ret;
>  
>  cleanup:
> -    VIR_FREE(ret);
> +    free(ret);
>      return NULL;
>  }
>  
> @@ -770,13 +770,13 @@ libvirt_virDomainGetSchedulerType(PyObject *self,
>  
>      /* convert to a Python tuple of long objects */
>      if ((info = PyTuple_New(2)) == NULL) {
> -        VIR_FREE(c_retval);
> +        free(c_retval);
>          return VIR_PY_NONE;
>      }
>  
>      PyTuple_SetItem(info, 0, libvirt_constcharPtrWrap(c_retval));
>      PyTuple_SetItem(info, 1, PyInt_FromLong((long)nparams));
> -    VIR_FREE(c_retval);
> +    free(c_retval);
>      return info;
>  }
>  
> @@ -803,7 +803,7 @@ libvirt_virDomainGetSchedulerParameters(PyObject *self,
>  
>      if (c_retval == NULL)
>          return VIR_PY_NONE;
> -    VIR_FREE(c_retval);
> +    free(c_retval);
>  
>      if (!nparams)
>          return PyDict_New();
> @@ -851,7 +851,7 @@ libvirt_virDomainGetSchedulerParametersFlags(PyObject *self,
>  
>      if (c_retval == NULL)
>          return VIR_PY_NONE;
> -    VIR_FREE(c_retval);
> +    free(c_retval);
>  
>      if (!nparams)
>          return PyDict_New();
> @@ -908,7 +908,7 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self,
>  
>      if (c_retval == NULL)
>          return VIR_PY_INT_FAIL;
> -    VIR_FREE(c_retval);
> +    free(c_retval);
>  
>      if (nparams == 0) {
>          PyErr_Format(PyExc_LookupError,
> @@ -945,7 +945,7 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -984,7 +984,7 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self,
>  
>      if (c_retval == NULL)
>          return VIR_PY_INT_FAIL;
> -    VIR_FREE(c_retval);
> +    free(c_retval);
>  
>      if (nparams == 0) {
>          PyErr_Format(PyExc_LookupError,
> @@ -1021,7 +1021,7 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -1095,7 +1095,7 @@ libvirt_virDomainSetBlkioParameters(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -1215,7 +1215,7 @@ libvirt_virDomainSetMemoryParameters(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -1335,7 +1335,7 @@ libvirt_virDomainSetNumaParameters(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -1456,7 +1456,7 @@ libvirt_virDomainSetInterfaceParameters(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -1617,14 +1617,14 @@ libvirt_virDomainGetVcpus(PyObject *self,
>          PyTuple_SetItem(pyretval, 1, pycpumap) < 0)
>          goto cleanup;
>  
> -    VIR_FREE(cpuinfo);
> -    VIR_FREE(cpumap);
> +    free(cpuinfo);
> +    free(cpumap);
>  
>      return pyretval;
>  
>  cleanup:
> -    VIR_FREE(cpuinfo);
> -    VIR_FREE(cpumap);
> +    free(cpuinfo);
> +    free(cpumap);
>      Py_XDECREF(pyretval);
>      Py_XDECREF(pycpuinfo);
>      Py_XDECREF(pycpumap);
> @@ -1692,7 +1692,7 @@ libvirt_virDomainPinVcpu(PyObject *self,
>      ret = VIR_PY_INT_SUCCESS;
>  
>  cleanup:
> -    VIR_FREE(cpumap);
> +    free(cpumap);
>      return ret;
>  }
>  
> @@ -1756,7 +1756,7 @@ libvirt_virDomainPinVcpuFlags(PyObject *self,
>      ret = VIR_PY_INT_SUCCESS;
>  
>  cleanup:
> -    VIR_FREE(cpumap);
> +    free(cpumap);
>      return ret;
>  }
>  
> @@ -1812,12 +1812,12 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self,
>          PyList_SetItem(pycpumaps, vcpu, mapinfo);
>      }
>  
> -    VIR_FREE(cpumaps);
> +    free(cpumaps);
>  
>      return pycpumaps;
>  
>  cleanup:
> -    VIR_FREE(cpumaps);
> +    free(cpumaps);
>  
>      Py_XDECREF(pycpumaps);
>  
> @@ -1864,7 +1864,7 @@ libvirt_virDomainPinEmulator(PyObject *self,
>          bool b;
>  
>          if (!flag || libvirt_boolUnwrap(flag, &b) < 0) {
> -            VIR_FREE(cpumap);
> +            free(cpumap);
>              return VIR_PY_INT_FAIL;
>          }
>  
> @@ -1881,7 +1881,7 @@ libvirt_virDomainPinEmulator(PyObject *self,
>      i_retval = virDomainPinEmulator(domain, cpumap, cpumaplen, flags);
>      LIBVIRT_END_ALLOW_THREADS;
>  
> -    VIR_FREE(cpumap);
> +    free(cpumap);
>  
>      if (i_retval < 0)
>          return VIR_PY_INT_FAIL;
> @@ -1922,12 +1922,12 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self,
>      ret = virDomainGetEmulatorPinInfo(domain, cpumap, cpumaplen, flags);
>      LIBVIRT_END_ALLOW_THREADS;
>      if (ret < 0) {
> -        VIR_FREE(cpumap);
> +        free(cpumap);
>          return VIR_PY_NONE;
>      }
>  
>      if (!(pycpumap = PyTuple_New(cpunum))) {
> -        VIR_FREE(cpumap);
> +        free(cpumap);
>          return NULL;
>      }
>  
> @@ -1936,7 +1936,7 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self,
>                           PyBool_FromLong(VIR_CPU_USABLE(cpumap, cpumaplen,
>                                                          0, pcpu)));
>  
> -    VIR_FREE(cpumap);
> +    free(cpumap);
>      return pycpumap;
>  }
>  
> @@ -2207,7 +2207,7 @@ libvirt_virConnectOpenAuth(PyObject *self, PyObject *args) {
>  
>      c_retval = virConnectOpenAuth(name, &auth, flags);
>      LIBVIRT_END_ALLOW_THREADS;
> -    VIR_FREE(auth.credtype);
> +    free(auth.credtype);
>      py_retval = libvirt_virConnectPtrWrap((virConnectPtr) c_retval);
>      return py_retval;
>  }
> @@ -2327,7 +2327,7 @@ libvirt_virConnectListDomainsID(PyObject *self,
>          c_retval = virConnectListDomains(conn, ids, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(ids);
> +            free(ids);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -2337,7 +2337,7 @@ libvirt_virConnectListDomainsID(PyObject *self,
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_intWrap(ids[i]));
>          }
> -        VIR_FREE(ids);
> +        free(ids);
>      }
>  
>      return py_retval;
> @@ -2386,7 +2386,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (doms[i])
>              virDomainFree(doms[i]);
> -    VIR_FREE(doms);
> +    free(doms);
>      return py_retval;
>  }
>  
> @@ -2418,7 +2418,7 @@ libvirt_virConnectListDefinedDomains(PyObject *self,
>          c_retval = virConnectListDefinedDomains(conn, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -2427,9 +2427,9 @@ libvirt_virConnectListDefinedDomains(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -2466,7 +2466,7 @@ libvirt_virDomainSnapshotListNames(PyObject *self,
>          c_retval = virDomainSnapshotListNames(dom, names, c_retval, flags);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -2482,13 +2482,13 @@ libvirt_virDomainSnapshotListNames(PyObject *self,
>              py_retval = NULL;
>              goto cleanup;
>          }
> -        VIR_FREE(names[i]);
> +        free(names[i]);
>      }
>  
>  cleanup:
>      for (i = 0; i < c_retval; i++)
> -        VIR_FREE(names[i]);
> -    VIR_FREE(names);
> +        free(names[i]);
> +    free(names);
>      return py_retval;
>  }
>  
> @@ -2534,7 +2534,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (snaps[i])
>              virDomainSnapshotFree(snaps[i]);
> -    VIR_FREE(snaps);
> +    free(snaps);
>      return py_retval;
>  }
>  
> @@ -2569,7 +2569,7 @@ libvirt_virDomainSnapshotListChildrenNames(PyObject *self,
>                                                        flags);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -2583,13 +2583,13 @@ libvirt_virDomainSnapshotListChildrenNames(PyObject *self,
>              py_retval = NULL;
>              goto cleanup;
>          }
> -        VIR_FREE(names[i]);
> +        free(names[i]);
>      }
>  
>  cleanup:
>      for (i = 0; i < c_retval; i++)
> -        VIR_FREE(names[i]);
> -    VIR_FREE(names);
> +        free(names[i]);
> +    free(names);
>      return py_retval;
>  }
>  
> @@ -2635,7 +2635,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (snaps[i])
>              virDomainSnapshotFree(snaps[i]);
> -    VIR_FREE(snaps);
> +    free(snaps);
>      return py_retval;
>  }
>  
> @@ -2902,7 +2902,7 @@ libvirt_virConnectListNetworks(PyObject *self,
>          c_retval = virConnectListNetworks(conn, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -2911,9 +2911,9 @@ libvirt_virConnectListNetworks(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -2948,7 +2948,7 @@ libvirt_virConnectListDefinedNetworks(PyObject *self,
>          c_retval = virConnectListDefinedNetworks(conn, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -2957,9 +2957,9 @@ libvirt_virConnectListDefinedNetworks(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -3008,7 +3008,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (nets[i])
>              virNetworkFree(nets[i]);
> -    VIR_FREE(nets);
> +    free(nets);
>      return py_retval;
>  }
>  
> @@ -3159,7 +3159,7 @@ libvirt_virNodeGetCellsFreeMemory(PyObject *self, PyObject *args)
>      LIBVIRT_END_ALLOW_THREADS;
>  
>      if (c_retval < 0) {
> -        VIR_FREE(freeMems);
> +        free(freeMems);
>          return VIR_PY_NONE;
>      }
>      py_retval = PyList_New(c_retval);
> @@ -3167,7 +3167,7 @@ libvirt_virNodeGetCellsFreeMemory(PyObject *self, PyObject *args)
>          PyList_SetItem(py_retval, i,
>                  libvirt_longlongWrap((long long) freeMems[i]));
>      }
> -    VIR_FREE(freeMems);
> +    free(freeMems);
>      return py_retval;
>  }
>  
> @@ -3203,7 +3203,7 @@ libvirt_virNodeGetCPUStats(PyObject *self, PyObject *args)
>          c_retval = virNodeGetCPUStats(conn, cpuNum, stats, &nparams, flags);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(stats);
> +            free(stats);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3225,11 +3225,11 @@ libvirt_virNodeGetCPUStats(PyObject *self, PyObject *args)
>          Py_DECREF(val);
>      }
>  
> -    VIR_FREE(stats);
> +    free(stats);
>      return ret;
>  
>  error:
> -    VIR_FREE(stats);
> +    free(stats);
>      Py_XDECREF(key);
>      Py_XDECREF(val);
>      return ret;
> @@ -3267,7 +3267,7 @@ libvirt_virNodeGetMemoryStats(PyObject *self, PyObject *args)
>          c_retval = virNodeGetMemoryStats(conn, cellNum, stats, &nparams, flags);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(stats);
> +            free(stats);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3289,11 +3289,11 @@ libvirt_virNodeGetMemoryStats(PyObject *self, PyObject *args)
>          Py_DECREF(val);
>      }
>  
> -    VIR_FREE(stats);
> +    free(stats);
>      return ret;
>  
>  error:
> -    VIR_FREE(stats);
> +    free(stats);
>      Py_XDECREF(key);
>      Py_XDECREF(val);
>      return ret;
> @@ -3327,7 +3327,7 @@ libvirt_virConnectListStoragePools(PyObject *self,
>          c_retval = virConnectListStoragePools(conn, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3335,8 +3335,8 @@ libvirt_virConnectListStoragePools(PyObject *self,
>      if (py_retval == NULL) {
>          if (names) {
>              for (i = 0; i < c_retval; i++)
> -                VIR_FREE(names[i]);
> -            VIR_FREE(names);
> +                free(names[i]);
> +            free(names);
>          }
>          return VIR_PY_NONE;
>      }
> @@ -3344,9 +3344,9 @@ libvirt_virConnectListStoragePools(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -3381,7 +3381,7 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self,
>          c_retval = virConnectListDefinedStoragePools(conn, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3389,8 +3389,8 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self,
>      if (py_retval == NULL) {
>          if (names) {
>              for (i = 0; i < c_retval; i++)
> -                VIR_FREE(names[i]);
> -            VIR_FREE(names);
> +                free(names[i]);
> +            free(names);
>          }
>          return VIR_PY_NONE;
>      }
> @@ -3398,9 +3398,9 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -3449,7 +3449,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (pools[i])
>              virStoragePoolFree(pools[i]);
> -    VIR_FREE(pools);
> +    free(pools);
>      return py_retval;
>  }
>  
> @@ -3481,7 +3481,7 @@ libvirt_virStoragePoolListVolumes(PyObject *self,
>          c_retval = virStoragePoolListVolumes(pool, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3489,8 +3489,8 @@ libvirt_virStoragePoolListVolumes(PyObject *self,
>      if (py_retval == NULL) {
>          if (names) {
>              for (i = 0; i < c_retval; i++)
> -                VIR_FREE(names[i]);
> -            VIR_FREE(names);
> +                free(names[i]);
> +            free(names);
>          }
>          return VIR_PY_NONE;
>      }
> @@ -3498,9 +3498,9 @@ libvirt_virStoragePoolListVolumes(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -3550,7 +3550,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (vols[i])
>              virStorageVolFree(vols[i]);
> -    VIR_FREE(vols);
> +    free(vols);
>      return py_retval;
>  }
>  
> @@ -3743,7 +3743,7 @@ libvirt_virNodeListDevices(PyObject *self,
>          c_retval = virNodeListDevices(conn, cap, names, c_retval, flags);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3752,9 +3752,9 @@ libvirt_virNodeListDevices(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -3803,7 +3803,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (devices[i])
>              virNodeDeviceFree(devices[i]);
> -    VIR_FREE(devices);
> +    free(devices);
>      return py_retval;
>  }
>  
> @@ -3834,7 +3834,7 @@ libvirt_virNodeDeviceListCaps(PyObject *self,
>          c_retval = virNodeDeviceListCaps(dev, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3843,9 +3843,9 @@ libvirt_virNodeDeviceListCaps(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -3954,7 +3954,7 @@ libvirt_virConnectListSecrets(PyObject *self,
>          c_retval = virConnectListSecrets(conn, uuids, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(uuids);
> +            free(uuids);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -3963,9 +3963,9 @@ libvirt_virConnectListSecrets(PyObject *self,
>      if (uuids) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(uuids[i]));
> -            VIR_FREE(uuids[i]);
> +            free(uuids[i]);
>          }
> -        VIR_FREE(uuids);
> +        free(uuids);
>      }
>  
>      return py_retval;
> @@ -4014,7 +4014,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (secrets[i])
>              virSecretFree(secrets[i]);
> -    VIR_FREE(secrets);
> +    free(secrets);
>      return py_retval;
>  }
>  
> @@ -4041,7 +4041,7 @@ libvirt_virSecretGetValue(PyObject *self,
>          return VIR_PY_NONE;
>  
>      py_retval = PyString_FromStringAndSize((const char *)c_retval, size);
> -    VIR_FREE(c_retval);
> +    free(c_retval);
>  
>      return py_retval;
>  }
> @@ -4174,7 +4174,7 @@ libvirt_virConnectListNWFilters(PyObject *self,
>          c_retval = virConnectListNWFilters(conn, uuids, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(uuids);
> +            free(uuids);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -4183,9 +4183,9 @@ libvirt_virConnectListNWFilters(PyObject *self,
>      if (uuids) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(uuids[i]));
> -            VIR_FREE(uuids[i]);
> +            free(uuids[i]);
>          }
> -        VIR_FREE(uuids);
> +        free(uuids);
>      }
>  
>      return py_retval;
> @@ -4234,7 +4234,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (filters[i])
>              virNWFilterFree(filters[i]);
> -    VIR_FREE(filters);
> +    free(filters);
>      return py_retval;
>  }
>  
> @@ -4266,7 +4266,7 @@ libvirt_virConnectListInterfaces(PyObject *self,
>          c_retval = virConnectListInterfaces(conn, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -4274,8 +4274,8 @@ libvirt_virConnectListInterfaces(PyObject *self,
>      if (py_retval == NULL) {
>          if (names) {
>              for (i = 0; i < c_retval; i++)
> -                VIR_FREE(names[i]);
> -            VIR_FREE(names);
> +                free(names[i]);
> +            free(names);
>          }
>          return VIR_PY_NONE;
>      }
> @@ -4283,9 +4283,9 @@ libvirt_virConnectListInterfaces(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -4321,7 +4321,7 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self,
>          c_retval = virConnectListDefinedInterfaces(conn, names, c_retval);
>          LIBVIRT_END_ALLOW_THREADS;
>          if (c_retval < 0) {
> -            VIR_FREE(names);
> +            free(names);
>              return VIR_PY_NONE;
>          }
>      }
> @@ -4329,8 +4329,8 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self,
>      if (py_retval == NULL) {
>          if (names) {
>              for (i = 0; i < c_retval; i++)
> -                VIR_FREE(names[i]);
> -            VIR_FREE(names);
> +                free(names[i]);
> +            free(names);
>          }
>          return VIR_PY_NONE;
>      }
> @@ -4338,9 +4338,9 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self,
>      if (names) {
>          for (i = 0; i < c_retval; i++) {
>              PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> -            VIR_FREE(names[i]);
> +            free(names[i]);
>          }
> -        VIR_FREE(names);
> +        free(names);
>      }
>  
>      return py_retval;
> @@ -4390,7 +4390,7 @@ cleanup:
>      for (i = 0; i < c_retval; i++)
>          if (ifaces[i])
>              virInterfaceFree(ifaces[i]);
> -    VIR_FREE(ifaces);
> +    free(ifaces);
>      return py_retval;
>  }
>  
> @@ -4421,7 +4421,7 @@ libvirt_virConnectBaselineCPU(PyObject *self,
>          for (i = 0; i < ncpus; i++) {
>              xmlcpus[i] = PyString_AsString(PyList_GetItem(list, i));
>              if (xmlcpus[i] == NULL) {
> -                VIR_FREE(xmlcpus);
> +                free(xmlcpus);
>                  return VIR_PY_INT_FAIL;
>              }
>          }
> @@ -4431,13 +4431,13 @@ libvirt_virConnectBaselineCPU(PyObject *self,
>      base_cpu = virConnectBaselineCPU(conn, xmlcpus, ncpus, flags);
>      LIBVIRT_END_ALLOW_THREADS;
>  
> -    VIR_FREE(xmlcpus);
> +    free(xmlcpus);
>  
>      if (base_cpu == NULL)
>          return VIR_PY_INT_FAIL;
>  
>      pybase_cpu = PyString_FromString(base_cpu);
> -    VIR_FREE(base_cpu);
> +    free(base_cpu);
>  
>      if (pybase_cpu == NULL)
>          return VIR_PY_INT_FAIL;
> @@ -4654,7 +4654,7 @@ libvirt_virDomainSetBlockIoTune(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -4752,8 +4752,8 @@ libvirt_virDomainGetDiskErrors(PyObject *self,
>  cleanup:
>      if (disks) {
>          for (i = 0; i < count; i++)
> -            VIR_FREE(disks[i].disk);
> -        VIR_FREE(disks);
> +            free(disks[i].disk);
> +        free(disks);
>      }
>      return py_retval;
>  }
> @@ -6841,7 +6841,7 @@ libvirt_virDomainBlockPeek(PyObject *self,
>      py_retval = PyString_FromStringAndSize(buf, size);
>  
>  cleanup:
> -    VIR_FREE(buf);
> +    free(buf);
>      return py_retval;
>  }
>  
> @@ -6878,7 +6878,7 @@ libvirt_virDomainMemoryPeek(PyObject *self,
>      py_retval = PyString_FromStringAndSize(buf, size);
>  
>  cleanup:
> -    VIR_FREE(buf);
> +    free(buf);
>      return py_retval;
>  }
>  
> @@ -6952,7 +6952,7 @@ libvirt_virNodeSetMemoryParameters(PyObject *self,
>  
>  cleanup:
>      virTypedParamsFree(params, nparams);
> -    VIR_FREE(new_params);
> +    free(new_params);
>      return ret;
>  }
>  
> @@ -7059,7 +7059,7 @@ libvirt_virNodeGetCPUMap(PyObject *self,
>          goto error;
>  
>  cleanup:
> -    VIR_FREE(cpumap);
> +    free(cpumap);
>      return ret;
>  error:
>      Py_XDECREF(ret);
> @@ -7110,7 +7110,7 @@ libvirt_virDomainCreateWithFiles(PyObject *self, PyObject *args) {
>      py_retval = libvirt_intWrap((int) c_retval);
>  
>  cleanup:
> -    VIR_FREE(files);
> +    free(files);
>      return py_retval;
>  }
>  
> @@ -7154,7 +7154,7 @@ libvirt_virDomainCreateXMLWithFiles(PyObject *self, PyObject *args) {
>      py_retval = libvirt_virDomainPtrWrap((virDomainPtr) c_retval);
>  
>  cleanup:
> -    VIR_FREE(files);
> +    free(files);
>      return py_retval;
>  }
>  
> diff --git a/libvirt-qemu-override.c b/libvirt-qemu-override.c
> index db69617..1707308 100644
> --- a/libvirt-qemu-override.c
> +++ b/libvirt-qemu-override.c
> @@ -78,7 +78,7 @@ libvirt_qemu_virDomainQemuMonitorCommand(PyObject *self ATTRIBUTE_UNUSED,
>          return VIR_PY_NONE;
>  
>      py_retval = PyString_FromString(result);
> -    VIR_FREE(result);
> +    free(result);
>      return py_retval;
>  }
>  
> @@ -108,7 +108,7 @@ libvirt_qemu_virDomainQemuAgentCommand(PyObject *self ATTRIBUTE_UNUSED, PyObject
>          return VIR_PY_NONE;
>  
>      py_retval = PyString_FromString(result);
> -    VIR_FREE(result);
> +    free(result);
>      return py_retval;
>  }
>  /************************************************************************
> diff --git a/typewrappers.c b/typewrappers.c
> index 9b88f3f..91c32fc 100644
> --- a/typewrappers.c
> +++ b/typewrappers.c
> @@ -86,7 +86,7 @@ libvirt_charPtrSizeWrap(char *str, Py_ssize_t size)
>          return Py_None;
>      }
>      ret = PyString_FromStringAndSize(str, size);
> -    VIR_FREE(str);
> +    free(str);
>      return ret;
>  }
>  
> @@ -100,7 +100,7 @@ libvirt_charPtrWrap(char *str)
>          return Py_None;
>      }
>      ret = PyString_FromString(str);
> -    VIR_FREE(str);
> +    free(str);
>      return ret;
>  }
>  
> -- 
> 1.8.3.1
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 


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