| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #3069
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 2 - Low, e.g. a documentation error or undocumented side-effect |
Scope: | 2 - Specific to an operating system |
Subsystem: | X11 |
Summary: | Fixed two memory leaks in Fl_x.cxx |
Version: | 1.3.2 |
Created By: | normvcr |
Assigned To: | AlbrechtS |
Fix Version: | 1.3.3 (SVN: v10323) |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | normvcr 15:53 Apr 16, 2014 |
| Platform: Fedora 19 x86. Fixed two memory leaks:
371c371 < int missing_count; --- > int missing_count = 0; 398a399,401 > > if( 0 < missing_count ) XFreeStringList( missing_list ); >
and
1545a1549,1551 > > //Do the free even if nitems=0 > XFree( words ); | |
|
#2 | AlbrechtS 14:53 Sep 18, 2014 |
| Thanks for the patch. I changed your code slightly and upload it with this post as str_3069.patch against svn r 10321.
The 2nd part of your patch is already fixed in svn. Our current code is:
if ( words ) { XFree(words); words = 0; }
(words is initialized to 0 before calling get_xwinprop()). This should be correct and avoids freeing a null pointer.
I'm not an X11 expert, and I have a question to part 1:
I can see your point, and so I added this code after initializing missing_list with 0:
// if (missing_count > 0) XFreeStringList(missing_list); if (missing_list) XFreeStringList(missing_list);
I commented out your code and used 'if (missing_list)' as the condition. Again, this should avoid freeing a null pointer.
But the question is: why use 'XFreeStringList()' to free the list? I did not even see a mention that the list should be free'd, although this sounds sensible. I checked this man page: http://www.x.org/releases/current/doc/man/man3/XCreateFontSet.3.xhtml
Is this per convention, or where can I verify that this is the correct way to free the list? | |
|
#3 | AlbrechtS 09:39 Sep 19, 2014 |
| With a little (offline) help from Norman (the OP) I found the docs. Thanks, Norman.
After a little more research I found in:
http://www.x.org/releases/current/doc/libX11/libX11/libX11.html#Creating_and_Freeing_a_Font_Set
"The returned XFontSet and missing charset list should be freed with XFreeFontSet and XFreeStringList, respectively. ..." | |
|
#4 | AlbrechtS 09:41 Sep 19, 2014 |
| Fixed in Subversion repository.
Thanks for the patch. | |
[ Return to Bugs & Features ]
|
| |