Use g_autoptr instead of virNetDevBandwidthFree 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:19 +01:00 committed by Ján Tomko
parent e4dd2a2c2e
commit 2870a164b9
4 changed files with 5 additions and 9 deletions

View File

@ -5397,7 +5397,7 @@ networkPortSetParameters(virNetworkPortPtr port,
virNetworkObjPtr obj;
virNetworkDefPtr def;
virNetworkPortDefPtr portdef;
virNetDevBandwidthPtr bandwidth = NULL;
g_autoptr(virNetDevBandwidth) bandwidth = NULL;
g_autofree char *dir = NULL;
int ret = -1;
size_t i;
@ -5473,7 +5473,6 @@ networkPortSetParameters(virNetworkPortPtr port,
ret = 0;
cleanup:
virNetDevBandwidthFree(bandwidth);
virNetworkObjEndAPI(&obj);
return ret;
}

View File

@ -10204,7 +10204,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
virDomainDefPtr persistentDef;
int ret = -1;
virDomainNetDefPtr net = NULL, persistentNet = NULL;
virNetDevBandwidthPtr bandwidth = NULL, newBandwidth = NULL;
g_autoptr(virNetDevBandwidth) bandwidth = NULL;
g_autoptr(virNetDevBandwidth) newBandwidth = NULL;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
bool inboundSpecified = false, outboundSpecified = false;
int actualType;
@ -10418,8 +10419,6 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
qemuDomainObjEndJob(driver, vm);
cleanup:
virNetDevBandwidthFree(bandwidth);
virNetDevBandwidthFree(newBandwidth);
virDomainObjEndAPI(&vm);
return ret;
}

View File

@ -3448,7 +3448,7 @@ testDomainSetInterfaceParameters(virDomainPtr dom,
virDomainObjPtr vm = NULL;
virDomainDefPtr def;
virDomainNetDefPtr net = NULL;
virNetDevBandwidthPtr bandwidth = NULL;
g_autoptr(virNetDevBandwidth) bandwidth = NULL;
bool inboundSpecified = false;
bool outboundSpecified = false;
size_t i;
@ -3538,7 +3538,6 @@ testDomainSetInterfaceParameters(virDomainPtr dom,
ret = 0;
cleanup:
virNetDevBandwidthFree(bandwidth);
virDomainObjEndAPI(&vm);
return ret;
}

View File

@ -69,7 +69,7 @@ testVirNetDevBandwidthSet(const void *data)
int ret = -1;
const struct testSetStruct *info = data;
const char *iface = info->iface;
virNetDevBandwidthPtr band = NULL;
g_autoptr(virNetDevBandwidth) band = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *actual_cmd = NULL;
@ -98,7 +98,6 @@ testVirNetDevBandwidthSet(const void *data)
ret = 0;
cleanup:
virCommandSetDryRun(NULL, NULL, NULL);
virNetDevBandwidthFree(band);
VIR_FREE(actual_cmd);
return ret;
}