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

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

 



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

- src/util/virrotatingfile.c

Signed-off-by: Barrett Schonefeld <bschoney@xxxxxxxxxx>
---
src/util/virrotatingfile.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c
index 9f1ef17c3e..6d8076e7c4 100644
--- a/src/util/virrotatingfile.c
+++ b/src/util/virrotatingfile.c
@@ -362,8 +362,8 @@ static int
virRotatingFileWriterRollover(virRotatingFileWriterPtr file)
{
    size_t i;
-    char *nextpath = NULL;
-    char *thispath = NULL;
+    g_autofree char *nextpath = NULL;
+    g_autofree char *thispath = NULL;
    int ret = -1;

    VIR_DEBUG("Rollover %s", file->basepath);
@@ -403,8 +403,6 @@ virRotatingFileWriterRollover(virRotatingFileWriterPtr file)

    ret = 0;
 cleanup:
-    VIR_FREE(nextpath);

nextpath is also freed in the loop, but here we need to preserve its
value across iterations.

I'd rather leave it uncoverted.

Jano

-    VIR_FREE(thispath);
    return ret;
}

--
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