Re: [PATCH 2/3] lib: Use g_autoptr() for virDomainDef

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

 



On a Thursday in 2021, Michal Privoznik wrote:
Instead of calling virDomainDefFree() explicitly, we can annotate
variables with g_autoptr().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/bhyve/bhyve_driver.c        | 15 +++++--------
src/bhyve/bhyve_parse_command.c |  8 ++-----
src/ch/ch_driver.c              |  6 ++----
src/conf/domain_conf.c          |  6 ++----
src/conf/virdomainobjlist.c     |  6 ++----
src/esx/esx_driver.c            | 14 ++++--------
src/libxl/libxl_domain.c        | 12 ++++-------
src/libxl/libxl_driver.c        | 38 +++++++++++----------------------
src/libxl/libxl_migration.c     |  3 +--
src/libxl/xen_xl.c              |  5 ++---
src/libxl/xen_xm.c              |  5 ++---
src/lxc/lxc_driver.c            | 24 +++++++--------------
src/lxc/lxc_native.c            |  5 ++---
src/openvz/openvz_conf.c        |  3 +--
src/openvz/openvz_driver.c      |  9 +++-----
src/qemu/qemu_saveimage.c       |  7 ++----
src/qemu/qemu_snapshot.c        |  6 ++----
src/test/test_driver.c          | 27 ++++++++---------------
src/vbox/vbox_common.c          | 14 ++++--------
src/vmware/vmware_conf.c        |  6 ++----
src/vmware/vmware_driver.c      | 10 +++------
src/vmx/vmx.c                   | 12 +++++------
src/vz/vz_driver.c              |  6 ++----
src/vz/vz_sdk.c                 |  6 ++----
tests/securityselinuxtest.c     |  8 +++----
25 files changed, 87 insertions(+), 174 deletions(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index edf5511e42..5562646a9e 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1940,8 +1940,8 @@ qemuSnapshotRevert(virDomainObj *vm,
    int detail;
    qemuDomainObjPrivate *priv = vm->privateData;
    int rc;
-    virDomainDef *config = NULL;
-    virDomainDef *inactiveConfig = NULL;
+    g_autoptr(virDomainDef) config = NULL;
+    g_autoptr(virDomainDef) inactiveConfig = NULL;
    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
    qemuDomainSaveCookie *cookie;
    virCPUDef *origCPU = NULL;
@@ -2235,8 +2235,6 @@ qemuSnapshotRevert(virDomainObj *vm,
    virObjectEventStateQueue(driver->domainEventState, event);
    virObjectEventStateQueue(driver->domainEventState, event2);
    virCPUDefFree(origCPU);
-    virDomainDefFree(config);
-    virDomainDefFree(inactiveConfig);

    return ret;
}

This was already done in
commit ebdd9a5842170fe993b51b2aa2f8aa08c816dbc1
    qemu_snapshot: revert: use g_autoptr

To the rest:

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[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