From: Michal Privoznik Date: Thu, 26 Jan 2023 10:56:10 +0000 (+0100) Subject: qemu_domain: Don't unref NULL hash table in qemuDomainRefreshStatsSchema() X-Git-Tag: v9.1.0-rc1~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3afde9211b550d3900edc5386ab121f5b39fd3e;p=thirdparty%2Flibvirt.git qemu_domain: Don't unref NULL hash table in qemuDomainRefreshStatsSchema() The g_hash_table_unref() function does not accept NULL. Passing NULL results in a glib warning being triggered. Check whether the hash table is not NULL and unref it only then. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b6ad118f1f..881c88d54c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11923,7 +11923,8 @@ qemuDomainRefreshStatsSchema(virDomainObj *dom) if (!schema) return -1; - g_hash_table_unref(priv->statsSchema); + if (priv->statsSchema) + g_hash_table_unref(priv->statsSchema); priv->statsSchema = schema; return 0;