Re: [PATCH 05/30] util: convert pointers to use g_autofree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



util: sysinfo:
in the commit summary

On a Monday in 2020, Ryan Gahagan wrote:
From: Barrett Schonefeld <bschoney@xxxxxxxxxx>


- src/util/virsysinfo.c


No need to mention the file.

Signed-off-by: Barrett Schonefeld <bschoney@xxxxxxxxxx>
---
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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux