Skip to content

Commit ff20794

Browse files
committed
Merge branch 'jk/unleak-fixes'
Fix some incorrect UNLEAK() annotations. * jk/unleak-fixes: ls-remote: simplify UNLEAK() usage stop calling UNLEAK() before die()
2 parents 11f433f + 3e19816 commit ff20794

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

bugreport.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,8 @@ int cmd_main(int argc, const char **argv)
175175
/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */
176176
report = open(report_path.buf, O_CREAT | O_EXCL | O_WRONLY, 0666);
177177

178-
if (report < 0) {
179-
UNLEAK(report_path);
178+
if (report < 0)
180179
die(_("couldn't create a new file at '%s'"), report_path.buf);
181-
}
182180

183181
if (write_in_full(report, buffer.buf, buffer.len) < 0)
184182
die_errno(_("unable to write to %s"), report_path.buf);

builtin/ls-remote.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
8383
PARSE_OPT_STOP_AT_NON_OPTION);
8484
dest = argv[0];
8585

86+
UNLEAK(sorting);
87+
8688
if (argc > 1) {
8789
int i;
8890
pattern = xcalloc(argc, sizeof(const char *));
@@ -107,7 +109,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
107109

108110
if (get_url) {
109111
printf("%s\n", *remote->url);
110-
UNLEAK(sorting);
111112
return 0;
112113
}
113114

@@ -122,10 +123,8 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
122123
int hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
123124
repo_set_hash_algo(the_repository, hash_algo);
124125
}
125-
if (transport_disconnect(transport)) {
126-
UNLEAK(sorting);
126+
if (transport_disconnect(transport))
127127
return 1;
128-
}
129128

130129
if (!dest && !quiet)
131130
fprintf(stderr, "From %s\n", *remote->url);
@@ -150,7 +149,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
150149
status = 0; /* we found something */
151150
}
152151

153-
UNLEAK(sorting);
154152
ref_array_clear(&ref_array);
155153
return status;
156154
}

midx.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,9 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
821821
int result = 0;
822822

823823
midx_name = get_midx_filename(object_dir);
824-
if (safe_create_leading_directories(midx_name)) {
825-
UNLEAK(midx_name);
824+
if (safe_create_leading_directories(midx_name))
826825
die_errno(_("unable to create leading directories of %s"),
827826
midx_name);
828-
}
829827

830828
if (m)
831829
packs.m = m;
@@ -1065,10 +1063,8 @@ void clear_midx_file(struct repository *r)
10651063
r->objects->multi_pack_index = NULL;
10661064
}
10671065

1068-
if (remove_path(midx)) {
1069-
UNLEAK(midx);
1066+
if (remove_path(midx))
10701067
die(_("failed to clear multi-pack-index at %s"), midx);
1071-
}
10721068

10731069
free(midx);
10741070
}

0 commit comments

Comments
 (0)