Commit 346672b0 authored by Youness Alaoui's avatar Youness Alaoui

Properly free memory in pseudotcp, and do it in finalize, not in dispose

parent 7e7cf461
...@@ -915,15 +915,15 @@ static void priv_destroy_component_tcp (Component *component) ...@@ -915,15 +915,15 @@ static void priv_destroy_component_tcp (Component *component)
g_source_unref (component->tcp_clock); g_source_unref (component->tcp_clock);
component->tcp_clock = NULL; component->tcp_clock = NULL;
} }
if (component->tcp_data != NULL) {
g_slice_free (TcpUserData, component->tcp_data);
component->tcp_data = NULL;
}
if (component->tcp) { if (component->tcp) {
pseudo_tcp_socket_close (component->tcp, TRUE); pseudo_tcp_socket_close (component->tcp, TRUE);
g_object_unref (component->tcp); g_object_unref (component->tcp);
component->tcp = NULL; component->tcp = NULL;
} }
if (component->tcp_data != NULL) {
g_slice_free (TcpUserData, component->tcp_data);
component->tcp_data = NULL;
}
} }
static void priv_pseudo_tcp_error (NiceAgent *agent, Stream *stream, static void priv_pseudo_tcp_error (NiceAgent *agent, Stream *stream,
......
...@@ -340,7 +340,7 @@ static void pseudo_tcp_socket_get_property (GObject *object, guint property_id, ...@@ -340,7 +340,7 @@ static void pseudo_tcp_socket_get_property (GObject *object, guint property_id,
GValue *value, GParamSpec *pspec); GValue *value, GParamSpec *pspec);
static void pseudo_tcp_socket_set_property (GObject *object, guint property_id, static void pseudo_tcp_socket_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec); const GValue *value, GParamSpec *pspec);
static void pseudo_tcp_socket_dispose (GObject *object); static void pseudo_tcp_socket_finalize (GObject *object);
static guint32 queue(PseudoTcpSocket *self, const gchar * data, static guint32 queue(PseudoTcpSocket *self, const gchar * data,
...@@ -364,7 +364,7 @@ pseudo_tcp_socket_class_init (PseudoTcpSocketClass *cls) ...@@ -364,7 +364,7 @@ pseudo_tcp_socket_class_init (PseudoTcpSocketClass *cls)
object_class->get_property = pseudo_tcp_socket_get_property; object_class->get_property = pseudo_tcp_socket_get_property;
object_class->set_property = pseudo_tcp_socket_set_property; object_class->set_property = pseudo_tcp_socket_set_property;
object_class->dispose = pseudo_tcp_socket_dispose; object_class->finalize = pseudo_tcp_socket_finalize;
g_object_class_install_property (object_class, PROP_CONVERSATION, g_object_class_install_property (object_class, PROP_CONVERSATION,
g_param_spec_uint ("conversation", "TCP Conversation ID", g_param_spec_uint ("conversation", "TCP Conversation ID",
...@@ -435,21 +435,33 @@ pseudo_tcp_socket_set_property (GObject *object, ...@@ -435,21 +435,33 @@ pseudo_tcp_socket_set_property (GObject *object,
} }
static void static void
pseudo_tcp_socket_dispose (GObject *object) pseudo_tcp_socket_finalize (GObject *object)
{ {
PseudoTcpSocket *self = PSEUDO_TCP_SOCKET (object); PseudoTcpSocket *self = PSEUDO_TCP_SOCKET (object);
PseudoTcpSocketPrivate *priv = self->priv; PseudoTcpSocketPrivate *priv = self->priv;
GList *i;
if (priv == NULL) if (priv == NULL)
return; return;
/*TODO: free slist/rlist/?*/ for (i = priv->slist; i; i = i->next) {
SSegment *sseg = i->data;
g_slice_free (SSegment, sseg);
}
for (i = priv->rlist; i; i = i->next) {
RSegment *rseg = i->data;
g_slice_free (RSegment, rseg);
}
g_list_free (priv->slist);
priv->slist = NULL;
g_list_free (priv->rlist);
priv->rlist = NULL;
g_free (priv); g_free (priv);
self->priv = NULL; self->priv = NULL;
if (G_OBJECT_CLASS (pseudo_tcp_socket_parent_class)->dispose) if (G_OBJECT_CLASS (pseudo_tcp_socket_parent_class)->finalize)
G_OBJECT_CLASS (pseudo_tcp_socket_parent_class)->dispose (object); G_OBJECT_CLASS (pseudo_tcp_socket_parent_class)->finalize (object);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment