On a Monday in 2020, Ryan Gahagan wrote:
From: Barrett Schonefeld <[email protected]>

- src/util/virrotatingfile.c

Signed-off-by: Barrett Schonefeld <[email protected]>
---
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

Reply via email to