[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc sect
From: |
Paul Fertser |
Subject: |
Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section. |
Date: |
Thu, 31 Mar 2016 15:56:30 +0300 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Mar 31, 2016 at 08:17:16AM -0400, Eric S. Raymond wrote:
> Sanjeev Gupta <address@hidden>:
> > On Thu, Mar 31, 2016 at 6:30 AM, Fred Wright <address@hidden> wrote:
> >
> > > One way to look at it is that the problem isn't malloc() - it's free().
> >
> >
> > So, let us allow use of malloc(), just ban free() ?
>
> Oh ghods no. We'd get memory leaks for sure.
Am I the only one who thought Sanjeev was just kidding? :)
> No, the right thing to do is ban any function that requires a following
> free() to deallocate the storage it allocates.
Explicit free() or any other "release" that does free() or other
resource management implicitly (e.g. fclose()). Nowadays there's a
wonderful tool to track leaks: valgrind, it would probably be fair to
require one to do a valgrind testing for any new code that involves
resource allocation.
--
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:address@hidden
- [gpsd-dev] [PATCH 1/2] hacking: mention signing off on patches and why it's a good thing., Beat Bolli, 2016/03/28
- [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Beat Bolli, 2016/03/28
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Paul Fertser, 2016/03/28
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Eric S. Raymond, 2016/03/28
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Fred Wright, 2016/03/30
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Eric S. Raymond, 2016/03/30
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Sanjeev Gupta, 2016/03/31
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Eric S. Raymond, 2016/03/31
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section.,
Paul Fertser <=
- Re: [gpsd-dev] [PATCH 2/2] hacking: mention strdup in the no-malloc section., Sanjeev Gupta, 2016/03/31
Re: [gpsd-dev] [PATCH 1/2] hacking: mention signing off on patches and why it's a good thing., Paul Fertser, 2016/03/28