Re: [PATCH v2 2/2] btrfs-progs: Fix up memory leakage

2012-09-26 Thread Goffredo Baroncelli
On 09/25/2012 07:14 PM, Goffredo Baroncelli wrote: I strongly disagree with this approach. The callee often don't know what happen after and before the call. The same is true for the programmer, because the code is quite often updated by several people. A clean exit() is the right thing to do as

Re: [PATCH v2 2/2] btrfs-progs: Fix up memory leakage

2012-09-25 Thread Zhi Yong Wu
On Wed, Sep 26, 2012 at 1:14 AM, Goffredo Baroncelli wrote: > On 09/25/2012 12:14 PM, David Sterba wrote: >> >> On Tue, Sep 25, 2012 at 10:02:16AM +0800, zwu.ker...@gmail.com wrote: >>> >>> From: Zhi Yong Wu >>> >>>Some code pathes forget to free memory on exit. >> >> >> Same as with the fd's,

Re: [PATCH v2 2/2] btrfs-progs: Fix up memory leakage

2012-09-25 Thread Goffredo Baroncelli
On 09/25/2012 12:14 PM, David Sterba wrote: On Tue, Sep 25, 2012 at 10:02:16AM +0800, zwu.ker...@gmail.com wrote: From: Zhi Yong Wu Some code pathes forget to free memory on exit. Same as with the fd's, kernel will free all memory for us at exit(). I strongly disagree with this approach.

Re: [PATCH v2 2/2] btrfs-progs: Fix up memory leakage

2012-09-25 Thread Zhi Yong Wu
On Tue, Sep 25, 2012 at 6:14 PM, David Sterba wrote: > On Tue, Sep 25, 2012 at 10:02:16AM +0800, zwu.ker...@gmail.com wrote: >> From: Zhi Yong Wu >> >> Some code pathes forget to free memory on exit. > > Same as with the fd's, kernel will free all memory for us at exit(). hi, can you let me kno

Re: [PATCH v2 2/2] btrfs-progs: Fix up memory leakage

2012-09-25 Thread David Sterba
On Tue, Sep 25, 2012 at 10:02:16AM +0800, zwu.ker...@gmail.com wrote: > From: Zhi Yong Wu > > Some code pathes forget to free memory on exit. Same as with the fd's, kernel will free all memory for us at exit(). If there's lots of memory allocated, it may be even faster to leave the unallocati