bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [PATCH] rewrote home_dir() to fix memleak


From: Tim Ruehsen
Subject: Re: [Bug-wget] [PATCH] rewrote home_dir() to fix memleak
Date: Thu, 12 Apr 2012 14:37:38 +0200
User-agent: KMail/1.13.7 (Linux/3.2.0-2-amd64; KDE/4.7.4; x86_64; ; )

Am Thursday 12 April 2012 schrieb Giuseppe Scrivano:
> Tim Ruehsen <address@hidden> writes:
> > Fixed a memleak found by Zhenbo Xu, reportted on 11.04.2012 to bug-wget.
> > 
> > 2012-04-12  Tim Ruehsen  <address@hidden>
> > 
> >     * 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

[Prev in Thread] Current Thread [Next in Thread]