dell: Fix the last of the memory leaks in the self tests

Fixes: https://github.com/hughsie/fwupd/issues/158
This commit is contained in:
Richard Hughes 2017-07-24 10:55:03 +01:00
parent 4bfcae2921
commit f592b06722

View File

@ -40,7 +40,7 @@ static void
_plugin_device_added_cb (FuPlugin *plugin, FuDevice *device, gpointer user_data)
{
FuDevice **dev = (FuDevice **) user_data;
*dev = g_object_ref (device);
g_set_object (dev, device);
}
static void
@ -117,6 +117,7 @@ fu_plugin_dell_tpm_func (void)
/* cleanup */
fu_plugin_device_remove (plugin, device_alt);
fu_plugin_device_remove (plugin, device);
g_clear_object (&device);
/* inject fake data:
* - that hasflashes
@ -148,6 +149,7 @@ fu_plugin_dell_tpm_func (void)
/* cleanup */
fu_plugin_device_remove (plugin, device_alt);
fu_plugin_device_remove (plugin, device);
g_clear_object (&device);
/* inject fake data:
* - that has flashes
@ -186,6 +188,7 @@ fu_plugin_dell_tpm_func (void)
/* cleanup */
fu_plugin_device_remove (plugin, device_alt);
fu_plugin_device_remove (plugin, device);
g_clear_object (&device);
/* inject fake data:
* - that has 1 flash left
@ -227,6 +230,7 @@ fu_plugin_dell_tpm_func (void)
/* cleanup */
fu_plugin_device_remove (plugin, device_alt);
fu_plugin_device_remove (plugin, device);
g_clear_object (&device);
}
static void
@ -307,7 +311,7 @@ fu_plugin_dell_dock_func (void)
fu_plugin_dell_device_added_cb (NULL, NULL,
plugin);
g_assert (device != NULL);
device = NULL;
g_clear_object (&device);
g_free (buf.record);
fu_plugin_dell_device_removed_cb (NULL, NULL,
plugin);
@ -344,7 +348,7 @@ fu_plugin_dell_dock_func (void)
fu_plugin_dell_device_added_cb (NULL, NULL,
plugin);
g_assert (device != NULL);
device = NULL;
g_clear_object (&device);
g_free (buf.record);
fu_plugin_dell_device_removed_cb (NULL, NULL,
plugin);
@ -379,7 +383,7 @@ fu_plugin_dell_dock_func (void)
fu_plugin_dell_device_added_cb (NULL, NULL,
plugin);
g_assert (device != NULL);
device = NULL;
g_clear_object (&device);
g_free (buf.record);
fu_plugin_dell_device_removed_cb (NULL, NULL,
plugin);
@ -414,7 +418,7 @@ fu_plugin_dell_dock_func (void)
fu_plugin_dell_device_added_cb (NULL, NULL,
plugin);
g_assert (device != NULL);
device = NULL;
g_clear_object (&device);
g_free (buf.record);
fu_plugin_dell_device_removed_cb (NULL, NULL,
plugin);