From 7f1499b8c8ea9441709f04e9403a7c3ca2e5baa6 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Mon, 14 Sep 2020 10:01:50 +0200 Subject: [PATCH] util: Use glib memory functions in virLastErrorObject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Wiederhake Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/util/virerror.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/virerror.c b/src/util/virerror.c index d89948f198..80a7cfe0ed 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -235,10 +235,9 @@ virLastErrorObject(void) virErrorPtr err; err = virThreadLocalGet(&virLastErr); if (!err) { - if (VIR_ALLOC_QUIET(err) < 0) - return NULL; + err = g_new0(virError, 1); if (virThreadLocalSet(&virLastErr, err) < 0) - VIR_FREE(err); + g_clear_pointer(&err, g_free); } return err; }