summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-08-13 15:55:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-13 18:04:58 (GMT)
commitd5e1961c19a2b638a700d03729cbb6c27fe5a3e8 (patch)
tree65a006210a42de947d1202d1bce01bfcd06378a4 /midx.c
parent47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc (diff)
downloadgit-d5e1961c19a2b638a700d03729cbb6c27fe5a3e8.zip
git-d5e1961c19a2b638a700d03729cbb6c27fe5a3e8.tar.gz
git-d5e1961c19a2b638a700d03729cbb6c27fe5a3e8.tar.bz2
stop calling UNLEAK() before die()
The point of UNLEAK() is to make a reference to a variable that is about to go out of scope so that leak-checkers will consider it to be not-leaked. Doing so right before die() is therefore pointless; even though we are about to exit the program, the variable will still be on the stack and accessible to leak-checkers. These annotations aren't really hurting anything, but they clutter the code and set a bad example of how to use UNLEAK(). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/midx.c b/midx.c
index 6d1584c..8af46e8 100644
--- a/midx.c
+++ b/midx.c
@@ -807,11 +807,9 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
int result = 0;
midx_name = get_midx_filename(object_dir);
- if (safe_create_leading_directories(midx_name)) {
- UNLEAK(midx_name);
+ if (safe_create_leading_directories(midx_name))
die_errno(_("unable to create leading directories of %s"),
midx_name);
- }
if (m)
packs.m = m;
@@ -1051,10 +1049,8 @@ void clear_midx_file(struct repository *r)
r->objects->multi_pack_index = NULL;
}
- if (remove_path(midx)) {
- UNLEAK(midx);
+ if (remove_path(midx))
die(_("failed to clear multi-pack-index at %s"), midx);
- }
free(midx);
}