qmi-port: plug memleak

Ensure we clear all allocated client objects when disposing the port.
This commit is contained in:
Aleksander Morgado
2012-09-18 19:10:05 +02:00
parent 127900b67b
commit b65bc50777
+12
View File
@@ -351,7 +351,19 @@ static void
dispose (GObject *object)
{
MMQmiPort *self = MM_QMI_PORT (object);
GList *l;
/* Deallocate all clients */
for (l = self->priv->services; l; l = g_list_next (l)) {
ServiceInfo *info = l->data;
if (info->client)
g_object_unref (info->client);
}
g_list_free_full (self->priv->services, (GDestroyNotify)g_free);
self->priv->services = NULL;
/* Clear device object */
g_clear_object (&self->priv->qmi_device);
G_OBJECT_CLASS (mm_qmi_port_parent_class)->dispose (object);