mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
9afa46d4a6
Fix memory leaks in two test-tools used by t0090-cache-tree.sh. As a result we can mark the test as passing with SANITIZE=leak using "TEST_PASSES_SANITIZE_LEAK=true". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 lines
516 B
C
20 lines
516 B
C
#include "test-tool.h"
|
|
#include "cache.h"
|
|
#include "lockfile.h"
|
|
#include "tree.h"
|
|
#include "cache-tree.h"
|
|
|
|
int cmd__scrap_cache_tree(int ac, const char **av)
|
|
{
|
|
struct lock_file index_lock = LOCK_INIT;
|
|
|
|
setup_git_directory();
|
|
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
|
|
if (read_cache() < 0)
|
|
die("unable to read index file");
|
|
cache_tree_free(&active_cache_tree);
|
|
active_cache_tree = NULL;
|
|
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
|
|
die("unable to write index file");
|
|
return 0;
|
|
}
|