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 787410 - entry: fix memory leak
entry: fix memory leak
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-09-07 13:37 UTC by Mohammed Sadiq
Modified: 2017-09-07 14:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
entry: fix memory leak (1000 bytes, patch)
2017-09-07 13:37 UTC, Mohammed Sadiq
committed Details | Review

Description Mohammed Sadiq 2017-09-07 13:37:12 UTC
.
Comment 1 Mohammed Sadiq 2017-09-07 13:37:20 UTC
Created attachment 359354 [details] [review]
entry: fix memory leak
Comment 2 Daniel Boles 2017-09-07 14:01:15 UTC
Great, many thanks for catching that - I was sure that get_tooltip_text() returned a const char*... but of course, it doesn't.

I pushed a cosmetically tweaked version of the fix to all 3 branches.
Comment 3 Mohammed Sadiq 2017-09-07 14:13:33 UTC
(In reply to Daniel Boles from comment #2)
> Great, many thanks for catching that - I was sure that get_tooltip_text()
> returned a const char*... but of course, it doesn't.
> 
> I pushed a cosmetically tweaked version of the fix to all 3 branches.

A few suggestions:

DON'T EVER EVER change the Author name unless the change you made is really big (This should be taken very seriously).

gtk_widget_get_tooltip_text returns NULL or a valid text, freeing a NULL isn't an error, so the else is redundant (unless the function is run a million+ times, and the return value is NULL 99% of the time).


Thanks
Comment 4 Daniel Boles 2017-09-07 14:18:16 UTC
(In reply to Mohammed Sadiq from comment #3)
> DON'T EVER EVER change the Author name unless the change you made is really
> big (This should be taken very seriously).

Apologies for the offence; I rewrote the commit but should've specifically set you as the author.


> gtk_widget_get_tooltip_text returns NULL or a valid text, freeing a NULL
> isn't an error, so the else is redundant (unless the function is run a
> million+ times, and the return value is NULL 99% of the time).

Sure, I guess this is just a pointless cosmetic preference I have.


Thanks again for the fix.
Comment 5 Mohammed Sadiq 2017-09-07 14:21:00 UTC
(In reply to Daniel Boles from comment #4)
> Apologies for the offence; I rewrote the commit but should've specifically
> set you as the author.
> 

This is not only for credit, but also for the blames. You don't need to get blamed for some one else's code, right? :-)