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

Re: [PATCH 2/3] bundle.c: fix memory leak

From
Stefan Beller <sbeller@google.com>
Date
Mar 10, 2015, 23:08 UTC
Message-ID
<CAGZ79kZ5=Q3WE6Ztr7PJ2Kv2xdKdCB2cD+_MH1GcqEDiZpU11w@mail.gmail.com>
In-Reply-To
<xmqq1tkwzdbj.fsf@gitster.dls.corp.google.com>
On Tue, Mar 10, 2015 at 3:40 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> The continue statements nearby also have an accompanying free(ref);
>>
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> ---
>
> I wonder what happens when dwim_ref() returned 2 or more, though.
That should also be fixed I guess. I'll look into it.

These one liner fixes are mostly done as a side project having fun, just doing what the code analysis tools says, sorry for not catching that one.

Maybe instead of the reoccuring pattern
    free(ref);
    continue;
we could just have a
    goto cleanup

which goes to the end of the loop where we have the free anyway.

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 13 in “connect.c: Fix memory leak”
  1. 1/3 connect.c: Fix memory leakStefan Beller, Mar 9, 2015
  2. 2/3 bundle.c: fix memory leakStefan Beller, Mar 9, 2015
  3. Junio C HamanoMar 10, 2015
  4. Stefan BellerMar 10, 2015
  5. Junio C HamanoMar 10, 2015
  6. 2/3 bundle.c: fix memory leakStefan Beller, Mar 10, 2015
  7. Junio C HamanoMar 11, 2015
  8. 3/3 builtin/help.c: fix memory leakStefan Beller, Mar 9, 2015
  9. Junio C HamanoMar 10, 2015
  10. Stefan BellerMar 10, 2015
  11. Junio C HamanoMar 11, 2015
  12. Torsten BögershausenMar 9, 2015
  13. Junio C HamanoMar 10, 2015

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.