After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782202 - linkbutton: Fix memory leak
linkbutton: Fix memory leak
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 782201 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-05-05 05:26 UTC by Mohammed Sadiq
Modified: 2017-05-05 09:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
linkbutton: Fix memory leak (1.39 KB, patch)
2017-05-05 05:26 UTC, Mohammed Sadiq
none Details | Review
linkbutton: Fix memory leak (1.39 KB, patch)
2017-05-05 08:10 UTC, Mohammed Sadiq
none Details | Review

Description Mohammed Sadiq 2017-05-05 05:26:19 UTC
strings returned by gtk_widget_get_tooltip_text() and
gtk_widget_get_tooltip_markup() has to be freed when no longer
required.
Comment 1 Mohammed Sadiq 2017-05-05 05:26:32 UTC
Created attachment 351149 [details] [review]
linkbutton: Fix memory leak
Comment 2 Mohammed Sadiq 2017-05-05 05:28:21 UTC
*** Bug 782201 has been marked as a duplicate of this bug. ***
Comment 3 Mohammed Sadiq 2017-05-05 05:30:11 UTC
This patch is against git master. That is, gtk4.

I have failed to build gtk+ master (using jhbuild make).
So all I have is hope that this patch won't break build. :)

Thanks
Comment 4 Timm Bäder 2017-05-05 07:33:45 UTC
Review of attachment 351149 [details] [review]:

LGTM except for that nitpick

::: gtk/gtklinkbutton.c
@@ +609,3 @@
+  if (text == NULL
+      && markup == NULL
+      && label && *label != '\0' && uri && strcmp (label, uri) != 0)

I know you didn't cause this, but now that you change those lines anyway: Can you put the && at the end of the previous line, like the other code does it?
Comment 5 Mohammed Sadiq 2017-05-05 08:10:31 UTC
Created attachment 351162 [details] [review]
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.
Comment 6 Timm Bäder 2017-05-05 09:20:24 UTC
Pushed as commit 00cd92ea71eae5d272f6f7cca58d71a29334ca4c.

Thanks!
Comment 7 Daniel Boles 2017-05-05 09:33:44 UTC
This only frees if the if condition evaluates to false. Isn't that wrong?
Comment 8 Daniel Boles 2017-05-05 09:34:08 UTC
(In reply to Daniel Boles from comment #7)
> This only frees if the if condition evaluates to false. Isn't that wrong?

...please ignore me. I have now woken up