This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Perl 5.7.2 (GDB breaks in 1.3.3-2 on certain Win2000 machines )


Christopher Faylor wrote:
> 
> For the curious, the difference in this code that I thought might
> solve the problem was setting the ui variable to NULL prior to the
> second invocation of NetUserGetInfo.
> 

Not that it is going to affect the bug that much but just setting the 
ui variable to NULL is a memory leak.  According to the MSDN docs:

bufptr 
  Pointer to the buffer in which the data set with the level parameter 
  is stored. The returned buffer should be deallocated using the 
  NetApiBufferFree function. 

Even though it would be unusual that a failed call would allocate
anything in ui, it is possible that the malloc happens before the 
actual call.  I would change 

	ui = NULL;

to 

	NetApiBufferFree( (LPVOID *)&ui);

(if my C coding is not too stale).

HTH

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]