From 881cb974236dd1db4d679005876369eb48c731ca Mon Sep 17 00:00:00 2001 From: jgeboski Date: Sun, 13 Sep 2015 15:57:46 -0400 Subject: facebook-data: fixed segfault when clearing the thread list The thread list is not being properly freed, as elements are left in the internal list. This ends up causing double frees. This fixes more than one use of the fbchats command segfaulting. --- facebook/facebook-data.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'facebook/facebook-data.c') diff --git a/facebook/facebook-data.c b/facebook/facebook-data.c index 443e00f..4d02ac1 100644 --- a/facebook/facebook-data.c +++ b/facebook/facebook-data.c @@ -259,19 +259,14 @@ void fb_data_clear_threads(FbData *fata) { FbDataPrivate *priv; - GList *l; - GList *n; + FbId *tid; g_return_if_fail(FB_IS_DATA(fata)); priv = fata->priv; - l = priv->tids->head; - - while (l != NULL) { - n = l->next; - g_queue_delete_link(priv->tids, l); - g_free(l->data); - l = n; + while (!g_queue_is_empty(priv->tids)) { + tid = g_queue_pop_head(priv->tids); + g_free(tid); } } -- cgit v1.2.3