aboutsummaryrefslogtreecommitdiffstats
path: root/facebook/facebook-data.c
diff options
context:
space:
mode:
authorjgeboski <jgeboski@gmail.com>2015-09-13 15:57:46 -0400
committerjgeboski <jgeboski@gmail.com>2015-09-13 15:57:46 -0400
commit881cb974236dd1db4d679005876369eb48c731ca (patch)
treea73476ded44e3a3500c370065bf674dbb7d935e9 /facebook/facebook-data.c
parent2d0eb7554371e76f78203a85c70d68e20b25bfb2 (diff)
downloadbitlbee-facebook-881cb974236dd1db4d679005876369eb48c731ca.tar.gz
bitlbee-facebook-881cb974236dd1db4d679005876369eb48c731ca.tar.bz2
bitlbee-facebook-881cb974236dd1db4d679005876369eb48c731ca.tar.xz
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.
Diffstat (limited to 'facebook/facebook-data.c')
-rw-r--r--facebook/facebook-data.c13
1 files changed, 4 insertions, 9 deletions
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);
}
}