Re: [PATCH 10/21] Free mktag's buffer before dying
- From
Johan Herland <johan@herland.net>
- Date
- Jun 9, 2007, 22:05 UTC
- Message-ID
- <200706100005.11710.johan@herland.net>
- In-Reply-To
- <81b0412b0706091500o2c0a8f88xd3808d6ee790d777@mail.gmail.com>
On Sunday 10 June 2007, Alex Riesen wrote:
Show 15 quoted lines
> On 6/9/07, Johan Herland <johan@herland.net> wrote:
> > On Saturday 09 June 2007, Alex Riesen wrote:
> > > On 6/9/07, Johan Herland <johan@herland.net> wrote:
> > > > + if (parse_and_verify_tag_buffer(0, buffer, size, 1)) {
> > > > + free(buffer);
> > > > + die("invalid tag data file");
> > >
> > > This, and the similar one below are useless. You're destroying the
> > > process, what do you free that buffer for? Either handle the error
> > > case or do not needlessly complicate your change, which really
> > > also absolutely unneeded.
> >
> > Well, I was taught to treat my memory with care.
>
> How do you treat your performance?Hopefully with care, as well. However, I tend to look at performance _after_ correctness.
> Besides, was that systems with common address space > where you were taught? Like DOS or MacOS, perhaps?
Nope. Never programmed on either. I thought care with memory was generally considered a good principle. If I'm wrong, please point me at the relevant documentation.
Show 7 quoted lines
> > Right now it doesn't make any difference in practice (except that > > Valgrind might be a bit happier with it), but in the future -- with > > the libifaction effort and whatnot -- you never know what might happen > > to this piece of code, and I'd like to stay on the safe side. > > So that people have to check your free as well (they will have to, > they come looking for die-calls). You just made more work for them.
Ok. Drop it. This isn't particularily important to me. I just try to follow good principles when I can.
...Johan
-- Johan Herland, <johan@herland.net> www.herland.net