mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
netdev_bandwidth_conf: Use g_autofree 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:
parent
d64f3f763f
commit
a40448c42f
@ -29,10 +29,10 @@ static int
|
|||||||
virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
|
virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *average = NULL;
|
g_autofree char *average = NULL;
|
||||||
char *peak = NULL;
|
g_autofree char *peak = NULL;
|
||||||
char *burst = NULL;
|
g_autofree char *burst = NULL;
|
||||||
char *floor = NULL;
|
g_autofree char *floor = NULL;
|
||||||
|
|
||||||
if (!node || !rate) {
|
if (!node || !rate) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
@ -88,11 +88,6 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(average);
|
|
||||||
VIR_FREE(peak);
|
|
||||||
VIR_FREE(burst);
|
|
||||||
VIR_FREE(floor);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +114,7 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
|
|||||||
virNetDevBandwidthPtr def = NULL;
|
virNetDevBandwidthPtr def = NULL;
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlNodePtr in = NULL, out = NULL;
|
xmlNodePtr in = NULL, out = NULL;
|
||||||
char *class_id_prop = NULL;
|
g_autofree char *class_id_prop = NULL;
|
||||||
|
|
||||||
def = g_new0(virNetDevBandwidth, 1);
|
def = g_new0(virNetDevBandwidth, 1);
|
||||||
|
|
||||||
@ -209,7 +204,6 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(class_id_prop);
|
|
||||||
virNetDevBandwidthFree(def);
|
virNetDevBandwidthFree(def);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user