mbox series

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

Message ID cover-v2-0.6-00000000000-20211022T085306Z-avarab@gmail.com (mailing list archive)
Headers show
Series leaks: miscellaneous small leak fixes | expand

Message

Ævar Arnfjörð Bjarmason Oct. 22, 2021, 8:55 a.m. UTC
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"