Re: [PATCH 3/3] submodule--helper: plug mem leak in print_default_remote
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 1, 2018, 08:46 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1806011046120.82@tvgsbejvaqbjf.bet>
- In-Reply-To
- <CAGZ79kZcjojZDoyhZovQmBLxUcMgECih4iUAYYFw4o_EeB3m2g@mail.gmail.com>
Hi Stefan,
On Thu, 31 May 2018, Stefan Beller wrote:
Show 33 quoted lines
> On Thu, May 31, 2018 at 5:07 AM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > Hi Stefan,
> >
> > On Wed, 30 May 2018, Stefan Beller wrote:
> >
> >> Signed-off-by: Stefan Beller <sbeller@google.com>
> >> ---
> >> builtin/submodule--helper.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> >> index 7c3cd9dbeba..96024fee1b1 100644
> >> --- a/builtin/submodule--helper.c
> >> +++ b/builtin/submodule--helper.c
> >> @@ -63,6 +63,7 @@ static int print_default_remote(int argc, const char **argv, const char *prefix)
> >> if (remote)
> >> printf("%s\n", remote);
> >>
> >> + free(remote);
> >
> > Makes sense.
> >
> > Out of curiosity (and because a cover letter is missing): how did you
> > stumble over these? Coverity?
>
> Yes I found them on coverity as I wanted to find out how bad their
> false positives are these days. So I looked at the most recent findings.
>
> I somehow imagined that we could redefine the _INIT macros which
> usually lead to false positives (just alloc&UNLEAK memory instead of
> pointing them all at the same memory for _INIT), but that experiment
> did not work out.Yes, those many, many, *many* false positives really drown out the benefit of Coverity for me. It takes all the fun out of looking for quick bug fixes.
Ciao, Dscho