From: Peter Krempa Date: Wed, 15 Feb 2023 10:02:10 +0000 (+0100) Subject: virLogCleanerShutdown: Don't call g_regex_unref on NULL regex X-Git-Tag: v9.1.0-rc1~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c8eff610ae957d920715b7bcf87fbcd8556b68a;p=thirdparty%2Flibvirt.git virLogCleanerShutdown: Don't call g_regex_unref on NULL regex 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é --- 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); }