diff options
author | Elijah Newren <newren@gmail.com> | 2020-08-18 22:58:25 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-18 17:17:29 -0700 |
commit | dad4f23ce59339bb32ad9e1cc1682c696f7a724f (patch) | |
tree | 44a55aa6e9c91af202fecd8887a7c175f1db3aa6 /t/t9135-git-svn-moved-branch-empty-file.sh | |
parent | Eighth batch (diff) | |
download | tgif-dad4f23ce59339bb32ad9e1cc1682c696f7a724f.tar.xz |
dir: make clear_directory() free all relevant memory
The calling convention for the dir API is supposed to end with a call to
clear_directory() to free up no longer needed memory. However,
clear_directory() didn't free dir->entries or dir->ignored. I believe
this was an oversight, but a number of callers noticed memory leaks and
started free'ing these. Unfortunately, they did so somewhat haphazardly
(sometimes freeing the entries in the arrays, and sometimes only
free'ing the arrays themselves). This suggests the callers weren't
trying to make sure any possible memory used might be free'd, but just
the memory they noticed their usecase definitely had allocated.
Fix this mess by moving all the duplicated free'ing logic into
clear_directory(). End by resetting dir to a pristine state so it could
be reused if desired.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9135-git-svn-moved-branch-empty-file.sh')
0 files changed, 0 insertions, 0 deletions