06-26-2006 04:56 AM
06-26-2006 01:36 PM
Interesting problem... I have not seen this before though I have used the password control before.
The good news is that the source code for this is available in the toolslib\toolbox\custctrl directory. You could add breakpoints to it to see if you can figure out what is happening.
A cursory look at the code shows that when the control is created, a data structure with various parameters for the control including a buffer for the obscured text and the length of the text is allocated using calloc. The control callback has a section for EVENT_DISCARD that calls a function that is supposed to release that data structure and free the memory. Without spending some time digging deeper, I don't see anything obvious that would create the leak.
06-26-2006 02:10 PM
I just couldn't leave this alone so I did a bit of digging.
It turns out that those two blocks of memory are allocated during a call to ChainCtrlCallback(). They are not subsequently removed after a call to UnchainCtrlCallback() where I would expect this to get cleaned up. Looks like you uncovered a memory leak bug, not in the password control code but in the UIR library.
I am attaching the output from an edited version of the example above and the pwctrl.c source file using CVIDynamicMemoryInfo() to snoop the state of the memory allocation at each step in the process of creating and destroying the control.
06-26-2006 03:16 PM
06-26-2006 03:26 PM