Re: [PATCH] Fix resource leaks in wrapper.c
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Oct 27, 2009, 11:44 UTC
- Message-ID
- <4AE6DD20.6000308@drmicha.warpmail.net>
- In-Reply-To
- <a362e8010910270335g106024e6if3f016c271ab55d6@mail.gmail.com>
Laszlo Papp venit, vidit, dixit 27.10.2009 11:35:
Show 31 quoted lines
> > > On Tue, Oct 27, 2009 at 9:26 AM, Michael J Gruber > <git@drmicha.warpmail.net <mailto:git@drmicha.warpmail.net>> wrote: > > Johannes Sixt venit, vidit, dixit 27.10.2009 08:13: > > Laszlo Papp schrieb: > >> @@ -266,7 +266,7 @@ int odb_mkstemp(char *template, size_t limit, > const char *pattern) > >> fd = mkstemp(template); > >> if (0 <= fd) > >> return fd; > >> - > >> + close(fd); > > > > Sorry, where is here a resource leak? You are "closing" something > that was > > never opened because fd is less than zero. > > > > Ditto for the other case. > > I guess it's about silencing some challenged code analysis tool. I > recall that last time we had something like this we decided that coders > are smarter than tools... and also that clean up like this (for real > leaks) would be something for libgit. > > Michael > > > Yeah you're rights guys, sorry for my fault, this cppcheck program is > not the best at this momment, really sorry.
No need to feel overly sorry, but in general it helps if, in a commit message or thereabout, you say something like "cppcheck found the following (potential) errors".
Cheers, Michael