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

[PATCH v2 0/6] leaks: miscellaneous small leak fixes

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 22, 2021, 08:55 UTC
Message-ID
<cover-v2-0.6-00000000000-20211022T085306Z-avarab@gmail.com>
In-Reply-To
<cover-0.6-00000000000-20211021T155529Z-avarab@gmail.com>

A re-roll of these miscellaneous small leak fixes to a address comments on v1. I ejected the patch that conflicted with Taylor's version (sorry, didn't notice it), and fixed an additional leak in grep.c pointed out by Junio. Doing that allowed us to mark a test as passing under SANITIZE=leak, with only the minor change of replacing a "git checkout" with "git reset --hard" (as "checkout" happens to leak currently, but I've also got a pending patch for that).

Ævar Arnfjörð Bjarmason (6):
  grep: prefer "struct grep_opt" over its "void *" equivalent
  grep: use object_array_clear() in cmd_grep()
  grep: fix a "path_list" memory leak
  clone: fix a memory leak of the "git_dir" variable
  submodule--helper: fix small memory leaks
  reflog: free() ref given to us by dwim_log()
 builtin/clone.c             |  4 +++-
 builtin/grep.c              | 14 ++++++++------
 builtin/reflog.c            |  1 +
 builtin/submodule--helper.c |  2 ++
 t/t7811-grep-open.sh        |  3 ++-
 5 files changed, 16 insertions(+), 8 deletions(-)
Range-diff against v1:
1:  2bdd21e4e59 ! 1:  66c838fd800 grep: prefer "struct grep_opt" over its "void *"
    @@ Metadata
     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## Commit message ##
    -    grep: prefer "struct grep_opt" over its "void *"
    +    grep: prefer "struct grep_opt" over its "void *" equivalent
     
         Stylistically fix up code added in bfac23d9534 (grep: Fix two memory
         leaks, 2010-01-30). We usually don't use the "arg" at all once we've
    -    unpacked it into the struct we want, let's not do that here when we're
    +    casted it to the struct we want, let's not do that here when we're
         freeing it. Perhaps it was thought that a cast to "void *" would
         otherwise be needed?
     
2:  727fdb27a2a = 2:  033ca3f7b4f grep: use object_array_clear() in cmd_grep()
-:  ----------- > 3:  8e941e40711 grep: fix a "path_list" memory leak
3:  86d928ae2f9 = 4:  0d0e6359cf4 clone: fix a memory leak of the "git_dir" variable
4:  9c3c0529ad0 = 5:  a529c04a29a submodule--helper: fix small memory leaks
5:  85b7b7aef37 = 6:  6ea5e611ae0 reflog: free() ref given to us by dwim_log()
6:  526d5649156 < -:  ----------- repack: stop leaking a "struct child_process"
-- 
2.33.1.1494.g88b39a443e1
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 14 of 20 in “leaks: miscellaneous small leak fixes”
  1. 0/6 leaks: miscellaneous small leak fixesÆvar Arnfjörð Bjarmason, Oct 21, 2021
  2. 1/6 grep: prefer "struct grep_opt" over its "void *"Ævar Arnfjörð Bjarmason, Oct 21, 2021
  3. Junio C HamanoOct 21, 2021
  4. 2/6 grep: use object_array_clear() in cmd_grep()Ævar Arnfjörð Bjarmason, Oct 21, 2021
  5. Junio C HamanoOct 21, 2021
  6. Junio C HamanoOct 21, 2021
  7. 3/6 clone: fix a memory leak of the "git_dir" variableÆvar Arnfjörð Bjarmason, Oct 21, 2021
  8. Junio C HamanoOct 22, 2021
  9. 4/6 submodule--helper: fix small memory leaksÆvar Arnfjörð Bjarmason, Oct 21, 2021
  10. 5/6 reflog: free() ref given to us by dwim_log()Ævar Arnfjörð Bjarmason, Oct 21, 2021
  11. Junio C HamanoOct 22, 2021
  12. 6/6 repack: stop leaking a "struct child_process"Ævar Arnfjörð Bjarmason, Oct 21, 2021
  13. Junio C HamanoOct 22, 2021
  14. 0/6 leaks: miscellaneous small leak fixesÆvar Arnfjörð Bjarmason, Oct 22, 2021
  15. 1/6 grep: prefer "struct grep_opt" over its "void *" equivalentÆvar Arnfjörð Bjarmason, Oct 22, 2021
  16. 2/6 grep: use object_array_clear() in cmd_grep()Ævar Arnfjörð Bjarmason, Oct 22, 2021
  17. 3/6 grep: fix a "path_list" memory leakÆvar Arnfjörð Bjarmason, Oct 22, 2021
  18. 4/6 clone: fix a memory leak of the "git_dir" variableÆvar Arnfjörð Bjarmason, Oct 22, 2021
  19. 5/6 submodule--helper: fix small memory leaksÆvar Arnfjörð Bjarmason, Oct 22, 2021
  20. 6/6 reflog: free() ref given to us by dwim_log()Ævar Arnfjörð Bjarmason, Oct 22, 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.