[PATCH] upowerd: Fix cleanup in up_device_idevice_coldplug/finalize
Richard Hughes
hughsient at gmail.com
Wed Oct 8 11:36:44 PDT 2014
Pushed to master with a small whitespace fixup. Thanks!
Richard
On 5 October 2014 06:03, Nikolay Martynov <mar.kolya at gmail.com> wrote:
> 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 at gmail.com>
> ---
> src/linux/up-device-idevice.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c
> index bf61a6f..699298c 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,9 @@ 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);
> }
> --
> 1.9.1
>
> _______________________________________________
> devkit-devel mailing list
> devkit-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/devkit-devel
More information about the devkit-devel
mailing list