possible mem leak due to some wrong placed XFree calls (+patch)
Original Reporter info from Mantis: crossbuilder
-
Reporter name: Burkhard Carstens
Original Reporter info from Mantis: crossbuilder
- Reporter name: Burkhard Carstens
Description:
In some places XFree is called only, if NumberOfItems > 0. While debugging I saw that even if NumberOfItems = 0 there might be data to be freed.
So instead of checking "if NuberOfItems > 0", it should be "if struct <> nil" before calling XFree.
E.g.: lcl/interfaces/gtk/gtk1extra.inc, line ~ 267:
XGetWindowProperty (xdisplay, xwindow,<br/>
_NET_WM_STATE,
0, MaxInt, False, XA_ATOM, @atomtype, @format, @nitems,
@bytes_after, gpointer(@state_array));
Here, X might allocate memory for state_array, even though nitems = 0
Attached is a patch to fix this. Tested this patch with lazarus trunk for two days without any problems.
Mantis conversion info:
- Mantis ID: 14659
- OS: linux
- OS Build: suse 10.0
- Build: 21830
- Platform: i386
- Version: 0.9.29 (SVN)
- Fixed in version: 0.9.30
- Fixed in revision: 21833 (#495f9f34)
- Target version: 0.9.30