Am Thursday 12 April 2012 schrieb Giuseppe Scrivano:
> Tim Ruehsen <[email protected]> writes:
> > Fixed a memleak found by Zhenbo Xu, reportted on 11.04.2012 to bug-wget.
> > 
> > 2012-04-12  Tim Ruehsen  <[email protected]>
> > 
> >     * rewrote home_dir() to fix memleak, removed need for freeing home
> 
> what is exactly the problem with the current code?

1. the MSDOS code was uncompilable and bloated.
2. the return value has been *unneccesarly* xstrdup'ed every time home_dir() 
was called. With the need, that the calling functions had to free the value. 
This has been forgotten in netrc.c/search_netrc().
3. two local variables had been static (wiothout reason).

My changes
 - remove the need of the above mentioned xstrdups/frees
 - change change the return value into read-only (const char *)
 - made the static variables gone away
 - the code is cleaner now

After all the changes seems to be trivial...

> 
> Thanks,
> Giuseppe

Tim

Reply via email to