find(1) memory leak in cygheap

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Aug 20 11:41:00 GMT 2009



Oh, btw., please http://cygwin.com/acronyms/#PCYMTNQREAIYR


On Aug 20 13:19, Corinna Vinschen wrote:
> On Aug 20 18:23, Haojun Bao wrote:
> > Great. In fact, I also found this code myself might cause problem in path.h:
> > (we should test if path is NULL, and free it before the memcpy, and
> > other member pointers should also be checked and free-ed first, is it
> > about right?:-)
> 
> Yes and no.  It might look cleaner to free the pointers at this point
> if they are non-NULL, but in fact the operator= is called after the
> path_conv content has been memcpy'ed to another fhandler.  So, if you
> free the pointers, you free the pointers of another file descriptor.
> SEGV's galore!

...which means, path_conv::operator= should only be called for
uninitialized fhandlers.  It would be a bug in Cygwin if it's called on
an already initialized fhandler (with the well known result).


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list