git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] submodule--helper: plug mem leak in print_default_remote

From
Stefan Beller <sbeller@google.com>
Date
May 31, 2018, 18:55 UTC
Message-ID
<CAGZ79kZcjojZDoyhZovQmBLxUcMgECih4iUAYYFw4o_EeB3m2g@mail.gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.1805311407140.82@tvgsbejvaqbjf.bet>

On Thu, May 31, 2018 at 5:07 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 23 quoted lines
> 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.

Thanks, Stefan

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 7 of 11 in “refs/packed-backend.c: close fd of empty file”
  1. 1/3 refs/packed-backend.c: close fd of empty fileStefan Beller, May 30, 2018
  2. 2/3 sequencer.c: free author variable when merging failsStefan Beller, May 30, 2018
  3. Johannes SchindelinMay 31, 2018
  4. Stefan BellerMay 31, 2018
  5. 3/3 submodule--helper: plug mem leak in print_default_remoteStefan Beller, May 30, 2018
  6. Johannes SchindelinMay 31, 2018
  7. Stefan BellerMay 31, 2018
  8. Johannes SchindelinJun 1, 2018
  9. Jeff KingMay 31, 2018
  10. Michael HaggertyMay 31, 2018
  11. Johannes SchindelinMay 31, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.