Use g_steal_pointer where possible

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>
This commit is contained in:
Kristina Hanicova 2021-03-03 11:48:18 +01:00 committed by Ján Tomko
parent bcb63a3bdc
commit e4dd2a2c2e
2 changed files with 3 additions and 6 deletions

View 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;

View 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);