diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tab-label.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tab-label.c b/src/tab-label.c index cd9f00d..3ea33d0 100644 --- a/src/tab-label.c +++ b/src/tab-label.c @@ -186,6 +186,8 @@ set_title(MqTabLabel *tab_label, const gchar *title) g_free(tab_label->title); tab_label->title = g_strdup(title); if (tab_label->scrolling) { + g_free(tab_label->scrolled_title); + g_free(tab_label->scrolled_markup); tab_label->scrolled_title = g_strdup_printf("%s ", title); tab_label->scrolled_markup = g_markup_printf_escaped(SCROLLED_TITLE_FMT, @@ -398,6 +400,12 @@ mq_tab_label_set_position(MqTabLabel *tab_label, guint position) void mq_tab_label_begin_scrolling(MqTabLabel *tab_label) { + if (tab_label->scrolling) { + /* Avoid leaking tab_label->scrolled_title and + * tab_label->scrolled_markup. */ + return; + } + tab_label->scrolling = TRUE; tab_label->scrolled_title = g_strdup_printf("%s ", tab_label->title); tab_label->scrolled_markup = g_markup_printf_escaped(SCROLLED_TITLE_FMT, @@ -408,6 +416,8 @@ void mq_tab_label_end_scrolling(MqTabLabel *tab_label) { tab_label->scrolling = FALSE; + g_free(tab_label->scrolled_title); + g_free(tab_label->scrolled_markup); update_label(tab_label); } @@ -436,6 +446,7 @@ mq_tab_label_scroll(MqTabLabel *tab_label) tab_label->scrolled_title[j] = c[i]; } + g_free(tab_label->scrolled_markup); tab_label->scrolled_markup = g_markup_printf_escaped(SCROLLED_TITLE_FMT, tab_label->scrolled_title); update_label(tab_label); |