diff options
author | Nikolay Martynov <mar.kolya@gmail.com> | 2014-10-05 01:03:42 -0400 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-10-08 19:36:18 +0100 |
commit | 3a5f3e552635a6935d5238eb37c555fd05eddbd9 (patch) | |
tree | 444f2e93a2212016622ae3d791db618cbbdff38f | |
parent | 68646992097f098e7faefe43f02af7b20bcf3c11 (diff) | |
download | upower-3a5f3e552635a6935d5238eb37c555fd05eddbd9.tar.gz |
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: Nikolay Martynov <mar.kolya@gmail.com>
Signed-off-by: Richard Hughes <richard@hughsie.com>
-rw-r--r-- | src/linux/up-device-idevice.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c index a77a099..b88fb1f 100644 --- a/src/linux/up-device-idevice.c +++ b/src/linux/up-device-idevice.c @@ -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); } |