Page 1 of 1

Memory leak in the C-function EnumWindows ()

Posted: Fri Aug 21, 2015 9:02 am
by gfilatov
Hi Claudio,

There is a confirmed memory leak in the callback of the function EnumWindows () :?

This line is wrong

Code: Select all

...
   hb_arrayAddForward (pArray, hb_itemPutNLL (NULL, (LONG_PTR) hWnd));
The simple fix of this problem is below

Code: Select all

  PHB_ITEM pHWnd = hb_itemPutNLL (NULL, (LONG_PTR) hWnd);

   hb_arrayAddForward (pArray, pHWnd);

   hb_itemRelease( pHWnd );
... 
Hope that helps :idea:

Re: Memory leak in the C-function EnumWindows ()

Posted: Fri Aug 21, 2015 1:25 pm
by Rathinagiri
Thanks for pointing out Grigory.

Re: Memory leak in the C-function EnumWindows ()

Posted: Fri Aug 21, 2015 3:35 pm
by srvet_claudio
Many thanks Grigory.
I will fix.

Re: Memory leak in the C-function EnumWindows ()

Posted: Fri Aug 21, 2015 4:31 pm
by srvet_claudio
srvet_claudio wrote:Many thanks Grigory.
I will fix.
Done!

Re: Memory leak in the C-function EnumWindows ()

Posted: Sat Aug 22, 2015 7:31 am
by serge_girard
Thanks Claudio!

Serge