Commit 3a5f3e55 authored by Nikolay Martynov's avatar Nikolay Martynov Committed by Richard Hughes

upowerd: Fix cleanup in up_device_idevice_coldplug/finalize

Under certain conditions lockdownd_client_free was called
twice for same client. This caused SIGSEGV.

This patch addresses this issue
Signed-off-by: 's avatarNikolay Martynov <mar.kolya@gmail.com>
Signed-off-by: Richard Hughes's avatarRichard Hughes <richard@hughsie.com>
parent 68646992
......@@ -138,10 +138,14 @@ up_device_idevice_coldplug (UpDevice *device)
return TRUE;
out:
if (client != NULL)
if (client != NULL) {
lockdownd_client_free (client);
if (dev != NULL)
idevice->priv->client = NULL;
}
if (dev != NULL) {
idevice_free (dev);
idevice->priv->dev = NULL;
}
return FALSE;
}
......@@ -238,7 +242,8 @@ up_device_idevice_finalize (GObject *object)
up_daemon_stop_poll (object);
if (idevice->priv->client != NULL)
lockdownd_client_free (idevice->priv->client);
idevice_free (idevice->priv->dev);
if (idevice->priv->dev != NULL)
idevice_free (idevice->priv->dev);
G_OBJECT_CLASS (up_device_idevice_parent_class)->finalize (object);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment