]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Use g_steal_pointer where possible
authorKristina Hanicova <khanicov@redhat.com>
Wed, 3 Mar 2021 10:48:18 +0000 (11:48 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 4 Mar 2021 16:30:08 +0000 (17:30 +0100)
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/network/bridge_driver.c
src/qemu/qemu_driver.c

index 519a4739952e128a48e20ea807a29b213e26c3a2..29060139d790d9eee0b3d961481db9aa4126f287 100644 (file)
@@ -5466,8 +5466,7 @@ networkPortSetParameters(virNetworkPortPtr port,
         goto cleanup;
 
     virNetDevBandwidthFree(portdef->bandwidth);
-    portdef->bandwidth = bandwidth;
-    bandwidth = NULL;
+    portdef->bandwidth = g_steal_pointer(&bandwidth);
 
     if (virNetworkPortDefSaveStatus(portdef, dir) < 0)
         goto cleanup;
index 9a6934f30fd0dd356c24112dfcb432098b507333..7026c5aef07b11f1b7139dd0b444e385ccd29166 100644 (file)
@@ -10372,8 +10372,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
 
         virNetDevBandwidthFree(net->bandwidth);
         if (newBandwidth->in || newBandwidth->out) {
-            net->bandwidth = newBandwidth;
-            newBandwidth = NULL;
+            net->bandwidth = g_steal_pointer(&newBandwidth);
         } else {
             net->bandwidth = NULL;
         }
@@ -10391,8 +10390,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
 
     if (persistentNet) {
         if (!persistentNet->bandwidth) {
-            persistentNet->bandwidth = bandwidth;
-            bandwidth = NULL;
+            persistentNet->bandwidth = g_steal_pointer(&bandwidth);
         } else {
             if (bandwidth->in) {
                 VIR_FREE(persistentNet->bandwidth->in);