From 8c8eff610ae957d920715b7bcf87fbcd8556b68a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 15 Feb 2023 11:02:10 +0100 Subject: [PATCH] virLogCleanerShutdown: Don't call g_regex_unref on NULL regex MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Shutdown of virtlogd prints: (process:54742): GLib-CRITICAL **: 11:00:40.873: g_regex_unref: assertion 'regex != NULL' failed Use g_clear_pointer instead which prevents it in the NULL case. Fixes: 69eeef5dfbf Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrangé --- src/logging/log_cleaner.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/logging/log_cleaner.c b/src/logging/log_cleaner.c index bb8f719f1b..38f818f177 100644 --- a/src/logging/log_cleaner.c +++ b/src/logging/log_cleaner.c @@ -264,6 +264,5 @@ virLogCleanerShutdown(virLogHandler *handler) handler->cleanup_log_timer = -1; } - g_regex_unref(log_regex); - log_regex = NULL; + g_clear_pointer(&log_regex, g_regex_unref); } -- 2.47.2