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

Re: To "const char *" and cast on free(), or "char *" and no cast...

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 15, 2021, 16:00 UTC
Message-ID
<xmqq5yty9t2n.fsf@gitster.g>
In-Reply-To
<5868076d-69cf-9b77-fa5c-5bb229333bd9@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
> If it was just the destructor that was free()'ing the values I'd agree
> but the struct gets mutated in other places as well.

Oh, if the members are meant to be mutated by the users (as opposed to the implementation) of the API around the type, I would agree that we'd be much better off having them non-const.

Thanks.
Previous: Phillip WoodNext: Eric Wong
Message 6 of 12 in “checkout: fix "branch info" memory leaks”
  1. checkout: fix "branch info" memory leaksÆvar Arnfjörð Bjarmason, Oct 14, 2021
  2. Phillip WoodOct 14, 2021
  3. To "const char *" and cast on free(), or "char *" and no cast...Ævar Arnfjörð Bjarmason, Oct 14, 2021
  4. Junio C HamanoOct 14, 2021
  5. Phillip WoodOct 15, 2021
  6. Junio C HamanoOct 15, 2021
  7. Eric WongOct 14, 2021
  8. Phillip WoodOct 15, 2021
  9. checkout: fix "branch info" memory leaksÆvar Arnfjörð Bjarmason, Oct 21, 2021
  10. Phillip WoodOct 24, 2021
  11. checkout: fix "branch info" memory leaksÆvar Arnfjörð Bjarmason, Nov 3, 2021
  12. checkout: fix "branch info" memory leaksÆvar Arnfjörð Bjarmason, Nov 16, 2021

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.