From a40448c42f18337453cc235f2102ce94a1cb6aea Mon Sep 17 00:00:00 2001 From: Kristina Hanicova Date: Wed, 3 Mar 2021 11:48:16 +0100 Subject: [PATCH] netdev_bandwidth_conf: Use g_autofree where possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristina Hanicova Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/conf/netdev_bandwidth_conf.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c index ff25641b2c..53cb6978bc 100644 --- a/src/conf/netdev_bandwidth_conf.c +++ b/src/conf/netdev_bandwidth_conf.c @@ -29,10 +29,10 @@ static int virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate) { int ret = -1; - char *average = NULL; - char *peak = NULL; - char *burst = NULL; - char *floor = NULL; + g_autofree char *average = NULL; + g_autofree char *peak = NULL; + g_autofree char *burst = NULL; + g_autofree char *floor = NULL; if (!node || !rate) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -88,11 +88,6 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate) ret = 0; cleanup: - VIR_FREE(average); - VIR_FREE(peak); - VIR_FREE(burst); - VIR_FREE(floor); - return ret; } @@ -119,7 +114,7 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth, virNetDevBandwidthPtr def = NULL; xmlNodePtr cur; xmlNodePtr in = NULL, out = NULL; - char *class_id_prop = NULL; + g_autofree char *class_id_prop = NULL; def = g_new0(virNetDevBandwidth, 1); @@ -209,7 +204,6 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth, ret = 0; cleanup: - VIR_FREE(class_id_prop); virNetDevBandwidthFree(def); return ret; }