summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-08-24 14:54:30 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-08-24 14:54:30 -0700
commitff20794402177adc52cab849b98fc85f3c2da739 (patch)
treed1feaa58edb34788e38ba0cbef3b4e2018ab4614
parentMerge branch 'en/dir-nonbare-embedded' (diff)
parentls-remote: simplify UNLEAK() usage (diff)
downloadtgif-ff20794402177adc52cab849b98fc85f3c2da739.tar.xz
Merge branch 'jk/unleak-fixes'
Fix some incorrect UNLEAK() annotations. * jk/unleak-fixes: ls-remote: simplify UNLEAK() usage stop calling UNLEAK() before die()
-rw-r--r--bugreport.c4
-rw-r--r--builtin/ls-remote.c8
-rw-r--r--midx.c8
3 files changed, 6 insertions, 14 deletions
diff --git a/bugreport.c b/bugreport.c
index 09579e268d..7ca0fba1b8 100644
--- a/bugreport.c
+++ b/bugreport.c
@@ -175,10 +175,8 @@ int cmd_main(int argc, const char **argv)
/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */
report = open(report_path.buf, O_CREAT | O_EXCL | O_WRONLY, 0666);
- if (report < 0) {
- UNLEAK(report_path);
+ if (report < 0)
die(_("couldn't create a new file at '%s'"), report_path.buf);
- }
if (write_in_full(report, buffer.buf, buffer.len) < 0)
die_errno(_("unable to write to %s"), report_path.buf);
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index ea91679f33..092917eca2 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -83,6 +83,8 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
PARSE_OPT_STOP_AT_NON_OPTION);
dest = argv[0];
+ UNLEAK(sorting);
+
if (argc > 1) {
int i;
pattern = xcalloc(argc, sizeof(const char *));
@@ -107,7 +109,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
if (get_url) {
printf("%s\n", *remote->url);
- UNLEAK(sorting);
return 0;
}
@@ -122,10 +123,8 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
int hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
repo_set_hash_algo(the_repository, hash_algo);
}
- if (transport_disconnect(transport)) {
- UNLEAK(sorting);
+ if (transport_disconnect(transport))
return 1;
- }
if (!dest && !quiet)
fprintf(stderr, "From %s\n", *remote->url);
@@ -150,7 +149,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
status = 0; /* we found something */
}
- UNLEAK(sorting);
ref_array_clear(&ref_array);
return status;
}
diff --git a/midx.c b/midx.c
index df33fac246..e046d03578 100644
--- a/midx.c
+++ b/midx.c
@@ -821,11 +821,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;
@@ -1065,10 +1063,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);
}