In the unlikely case that we were unable to set the new
identity, we would unref the old one even though it still
could be in the thread-local storage.
Fixes: c6825d88137cb8e4debdf4310e45ee23cb5698c0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
*/
int virIdentitySetCurrent(virIdentity *ident)
{
- g_autoptr(virIdentity) old = NULL;
+ virIdentity *old = NULL;
if (virIdentityInitialize() < 0)
return -1;
return -1;
}
+ if (old)
+ g_object_unref(old);
return 0;
}