From c9b2e177267b623850b3deedb1242de7d2e413ee Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 26 Jun 2015 14:07:13 +0200 Subject: linux: Fix possible double-free When reopening the lockdown daemon with upower as the client, don't double-free if the user says "No" to trusting the laptop. https://bugzilla.redhat.com/show_bug.cgi?id=1231763 diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c index 9722774..6ab1bf8 100644 --- a/src/linux/up-device-idevice.c +++ b/src/linux/up-device-idevice.c @@ -74,7 +74,7 @@ start_poll_cb (UpDeviceIdevice *idevice) UpDevice *device = UP_DEVICE (idevice); idevice_t dev = NULL; lockdownd_client_t client = NULL; - char *uuid; + char *uuid = NULL; g_object_get (G_OBJECT (idevice), "serial", &uuid, NULL); g_assert (uuid); @@ -83,7 +83,7 @@ start_poll_cb (UpDeviceIdevice *idevice) if (idevice_new (&dev, uuid) != IDEVICE_E_SUCCESS) goto out; - g_free (uuid); + g_clear_pointer (&uuid, g_free); if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake (dev, &client, "upower")) goto out; @@ -111,7 +111,7 @@ start_poll_cb (UpDeviceIdevice *idevice) out: g_clear_pointer (&client, lockdownd_client_free); g_clear_pointer (&dev, idevice_free); - g_free (uuid); + g_clear_pointer (&uuid, g_free); return G_SOURCE_CONTINUE; } -- cgit v0.10.2