linkbutton: Fix memory leak

strings returned by gtk_widget_get_tooltip_text() and
gtk_widget_get_tooltip_markup() has to be freed when no longer
required.

https://bugzilla.gnome.org/show_bug.cgi?id=782202
This commit is contained in:
Mohammed Sadiq 2017-05-05 10:52:27 +05:30 committed by Timm Bäder
parent 3d21128dbb
commit 00cd92ea71

View File

@ -599,18 +599,24 @@ gtk_link_button_query_tooltip_cb (GtkWidget *widget,
{ {
GtkLinkButton *link_button = GTK_LINK_BUTTON (widget); GtkLinkButton *link_button = GTK_LINK_BUTTON (widget);
const gchar *label, *uri; const gchar *label, *uri;
gchar *text, *markup;
label = gtk_button_get_label (GTK_BUTTON (link_button)); label = gtk_button_get_label (GTK_BUTTON (link_button));
uri = link_button->priv->uri; uri = link_button->priv->uri;
text = gtk_widget_get_tooltip_text (widget);
markup = gtk_widget_get_tooltip_markup (widget);
if (!gtk_widget_get_tooltip_text (widget) if (text == NULL &&
&& !gtk_widget_get_tooltip_markup (widget) markup == NULL &&
&& label && *label != '\0' && uri && strcmp (label, uri) != 0) label && *label != '\0' && uri && strcmp (label, uri) != 0)
{ {
gtk_tooltip_set_text (tooltip, uri); gtk_tooltip_set_text (tooltip, uri);
return TRUE; return TRUE;
} }
g_free (text);
g_free (markup);
return FALSE; return FALSE;
} }