mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 16:11:22 +00:00
trivial: Fix memory leak if fu_device_set_parent() is called multiple times
This commit is contained in:
parent
00a0be068a
commit
4eb7cec24b
@ -478,7 +478,10 @@ fu_device_set_parent (FuDevice *self, FuDevice *parent)
|
||||
|
||||
g_return_if_fail (FU_IS_DEVICE (self));
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (parent), (gpointer *) &priv->parent);
|
||||
if (priv->parent != NULL)
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->parent), (gpointer *) &priv->parent);
|
||||
if (parent != NULL)
|
||||
g_object_add_weak_pointer (G_OBJECT (parent), (gpointer *) &priv->parent);
|
||||
priv->parent = parent;
|
||||
|
||||
/* this is what goes over D-Bus */
|
||||
|
Loading…
Reference in New Issue
Block a user