gdbusdaemon: Add an assertion to help static analysis of refcounts

This should fix a scan-build warning about the final `name_unref()` here
being a use-after-free.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2022-05-10 16:17:38 +01:00
parent 86927c39e0
commit 7767978725

View File

@ -874,7 +874,11 @@ client_free (Client *client)
name_ref (name);
if (name->owner && name->owner->client == client)
name_release_owner (name);
{
/* Help static analysers with the refcount at this point. */
g_assert (name->refcount >= 2);
name_release_owner (name);
}
name_unqueue_owner (name, client);