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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2023-01-26 11:56:10 +01:00
parent 95a278a845
commit c3afde9211

View File

@ -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;