util: sysinfo:
in the commit summary
On a Monday in 2020, Ryan Gahagan wrote:
From: Barrett Schonefeld <bschoney(a)utexas.edu>
- src/util/virsysinfo.c
No need to mention the file.
Signed-off-by: Barrett Schonefeld <bschoney(a)utexas.edu>
---
src/util/virsysinfo.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 217f842a37..36317c97eb 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -393,7 +393,7 @@ virSysinfoParseARMProcessor(const char *base, virSysinfoDefPtr ret)
const char *cur;
char *eol, *tmp_base;
virSysinfoProcessorDefPtr processor;
- char *processor_type = NULL;
+ g_autofree char *processor_type = NULL;
if (!(tmp_base = strstr(base, "model name")) &&
!(tmp_base = strstr(base, "Processor")))
@@ -424,12 +424,10 @@ virSysinfoParseARMProcessor(const char *base, virSysinfoDefPtr ret)
base = cur;
}
- VIR_FREE(processor_type);
return 0;
error:
- VIR_FREE(processor_type);
- return -1;
+ return -1;
Unrelated whitespace change.
}
/* virSysinfoRead for ARMv7
@@ -532,9 +530,9 @@ static int
virSysinfoParseS390Processor(const char *base, virSysinfoDefPtr ret)
{
const char *tmp_base;
- char *manufacturer = NULL;
- char *procline = NULL;
- char *ncpu = NULL;
+ g_autofree char *manufacturer = NULL;
+ g_autofree char *procline = NULL;
+ g_autofree char *ncpu = NULL;
These two belong in their respective loops below.
Jano
int result = -1;
virSysinfoProcessorDefPtr processor;
@@ -593,9 +591,6 @@ virSysinfoParseS390Processor(const char *base, virSysinfoDefPtr ret)
result = 0;
error:
- VIR_FREE(manufacturer);
- VIR_FREE(procline);
- VIR_FREE(ncpu);
return result;
}
--
2.29.0