Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/network/bridge_driver.c | 3 +--
src/qemu/qemu_driver.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 519a473995..29060139d7 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b9bbdf8d48..b18e46e383 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10375,8 +10375,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;
}
@@ -10394,8 +10393,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);
--
2.29.2