Merge branch 'ps/leakfixes-part-5'

Even more leak fixes.

* ps/leakfixes-part-5:
  transport: fix leaking negotiation tips
  transport: fix leaking arguments when fetching from bundle
  builtin/fetch: fix leaking transaction with `--atomic`
  remote: fix leaking peer ref when expanding refmap
  remote: fix leaks when matching refspecs
  remote: fix leaking config strings
  builtin/fetch-pack: fix leaking refs
  sideband: fix leaks when configuring sideband colors
  builtin/send-pack: fix leaking refspecs
  transport: fix leaking OID arrays in git:// transport data
  t/helper: fix leaking multi-pack-indices in "read-midx"
  builtin/repack: fix leaks when computing packs to repack
  midx-write: fix leaking hashfile on error cases
  builtin/archive: fix leaking `OPT_FILENAME()` value
  builtin/upload-archive: fix leaking args passed to `write_archive()`
  builtin/merge-tree: fix leaking `-X` strategy options
  pretty: fix leaking key/value separator buffer
  pretty: fix memory leaks when parsing pretty formats
  convert: fix leaks when resetting attributes
  mailinfo: fix leaking header data
This commit is contained in:
Junio C Hamano 2024-09-03 09:14:59 -07:00
commit 8c1c63d525
41 changed files with 237 additions and 73 deletions

View file

@ -736,6 +736,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
struct pretty_print_describe_status describe_status = {0};
struct pretty_print_context ctx = {0};
struct archiver_args args;
const char **argv_copy;
int rc;
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
@ -749,6 +750,14 @@ int write_archive(int argc, const char **argv, const char *prefix,
args.repo = repo;
args.prefix = prefix;
string_list_init_dup(&args.extra_files);
/*
* `parse_archive_args()` modifies contents of `argv`, which is what we
* want. Our callers may not want it though, so we create a copy here.
*/
DUP_ARRAY(argv_copy, argv, argc);
argv = argv_copy;
argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote);
if (!startup_info->have_repository) {
/*
@ -767,6 +776,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
string_list_clear_func(&args.extra_files, extra_file_info_clear);
free(args.refname);
clear_pathspec(&args.pathspec);
free(argv_copy);
return rc;
}

View file

@ -100,13 +100,16 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
if (output)
create_output_file(output);
if (remote)
return run_remote_archiver(argc, argv, remote, exec, output);
if (remote) {
ret = run_remote_archiver(argc, argv, remote, exec, output);
goto out;
}
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
ret = write_archive(argc, argv, prefix, the_repository, output, 0);
out:
free(output);
return ret;
}

View file

@ -221,7 +221,9 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
&extra_index_pack_args, 0) ||
list_bundle_refs(&header, argc, argv);
bundle_header_release(&header);
cleanup:
strvec_clear(&extra_index_pack_args);
free(bundle_file);
return ret;
}

View file

@ -46,7 +46,7 @@ static void add_sought_entry(struct ref ***sought, int *nr, int *alloc,
int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
{
int i, ret;
struct ref *ref = NULL;
struct ref *fetched_refs = NULL, *remote_refs = NULL;
const char *dest = NULL;
struct ref **sought = NULL;
int nr_sought = 0, alloc_sought = 0;
@ -228,19 +228,20 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
version = discover_version(&reader);
switch (version) {
case protocol_v2:
get_remote_refs(fd[1], &reader, &ref, 0, NULL, NULL,
get_remote_refs(fd[1], &reader, &remote_refs, 0, NULL, NULL,
args.stateless_rpc);
break;
case protocol_v1:
case protocol_v0:
get_remote_heads(&reader, &ref, 0, NULL, &shallow);
get_remote_heads(&reader, &remote_refs, 0, NULL, &shallow);
break;
case protocol_unknown_version:
BUG("unknown protocol version");
}
ref = fetch_pack(&args, fd, ref, sought, nr_sought,
fetched_refs = fetch_pack(&args, fd, remote_refs, sought, nr_sought,
&shallow, pack_lockfiles_ptr, version);
if (pack_lockfiles.nr) {
int i;
@ -260,7 +261,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
if (finish_connect(conn))
return 1;
ret = !ref;
ret = !fetched_refs;
/*
* If the heads to pull were given, we should have consumed
@ -270,11 +271,14 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
*/
ret |= report_unmatched_refs(sought, nr_sought);
while (ref) {
for (struct ref *ref = fetched_refs; ref; ref = ref->next)
printf("%s %s\n",
oid_to_hex(&ref->old_oid), ref->name);
ref = ref->next;
}
for (size_t i = 0; i < nr_sought; i++)
free_one_ref(sought[i]);
free(sought);
free_refs(fetched_refs);
free_refs(remote_refs);
return ret;
}

View file

@ -1731,11 +1731,8 @@ static int do_fetch(struct transport *transport,
goto cleanup;
retcode = ref_transaction_commit(transaction, &err);
if (retcode) {
ref_transaction_free(transaction);
transaction = NULL;
if (retcode)
goto cleanup;
}
}
commit_fetch_head(&fetch_head);
@ -1803,8 +1800,11 @@ static int do_fetch(struct transport *transport,
if (transaction && ref_transaction_abort(transaction, &err) &&
err.len)
error("%s", err.buf);
transaction = NULL;
}
if (transaction)
ref_transaction_free(transaction);
display_state_release(&display_state);
close_fetch_head(&fetch_head);
strbuf_release(&err);

View file

@ -533,6 +533,7 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
int expected_remaining_argc;
int original_argc;
const char *merge_base = NULL;
int ret;
const char * const merge_tree_usage[] = {
N_("git merge-tree [--write-tree] [<options>] <branch1> <branch2>"),
@ -625,7 +626,9 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
strbuf_list_free(split);
}
strbuf_release(&buf);
return 0;
ret = 0;
goto out;
}
/* Figure out which mode to use */
@ -664,7 +667,11 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
/* Do the relevant type of merge */
if (o.mode == MODE_REAL)
return real_merge(&o, merge_base, argv[0], argv[1], prefix);
ret = real_merge(&o, merge_base, argv[0], argv[1], prefix);
else
return trivial_merge(argv[0], argv[1], argv[2]);
ret = trivial_merge(argv[0], argv[1], argv[2]);
out:
strvec_clear(&xopts);
return ret;
}

View file

@ -732,14 +732,23 @@ static void midx_included_packs(struct string_list *include,
struct pack_geometry *geometry)
{
struct string_list_item *item;
struct strbuf buf = STRBUF_INIT;
for_each_string_list_item(item, &existing->kept_packs) {
strbuf_reset(&buf);
strbuf_addf(&buf, "%s.idx", item->string);
string_list_insert(include, buf.buf);
}
for_each_string_list_item(item, names) {
strbuf_reset(&buf);
strbuf_addf(&buf, "pack-%s.idx", item->string);
string_list_insert(include, buf.buf);
}
for_each_string_list_item(item, &existing->kept_packs)
string_list_insert(include, xstrfmt("%s.idx", item->string));
for_each_string_list_item(item, names)
string_list_insert(include, xstrfmt("pack-%s.idx", item->string));
if (geometry->split_factor) {
struct strbuf buf = STRBUF_INIT;
uint32_t i;
for (i = geometry->split; i < geometry->pack_nr; i++) {
struct packed_git *p = geometry->pack[i];
@ -754,17 +763,21 @@ static void midx_included_packs(struct string_list *include,
if (!p->pack_local)
continue;
strbuf_reset(&buf);
strbuf_addstr(&buf, pack_basename(p));
strbuf_strip_suffix(&buf, ".pack");
strbuf_addstr(&buf, ".idx");
string_list_insert(include, strbuf_detach(&buf, NULL));
string_list_insert(include, buf.buf);
}
} else {
for_each_string_list_item(item, &existing->non_kept_packs) {
if (pack_is_marked_for_deletion(item))
continue;
string_list_insert(include, xstrfmt("%s.idx", item->string));
strbuf_reset(&buf);
strbuf_addf(&buf, "%s.idx", item->string);
string_list_insert(include, buf.buf);
}
}
@ -784,8 +797,13 @@ static void midx_included_packs(struct string_list *include,
*/
if (pack_is_marked_for_deletion(item))
continue;
string_list_insert(include, xstrfmt("%s.idx", item->string));
strbuf_reset(&buf);
strbuf_addf(&buf, "%s.idx", item->string);
string_list_insert(include, buf.buf);
}
strbuf_release(&buf);
}
static int write_midx_included_packs(struct string_list *include,
@ -1476,7 +1494,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
mark_packs_for_deletion(&existing, &names);
if (write_midx) {
struct string_list include = STRING_LIST_INIT_NODUP;
struct string_list include = STRING_LIST_INIT_DUP;
midx_included_packs(&include, &existing, &names, &geometry);
ret = write_midx_included_packs(&include, &geometry, &names,

View file

@ -338,5 +338,6 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
free_refs(remote_refs);
free_refs(local_refs);
refspec_clear(&rs);
return ret;
}

View file

@ -22,6 +22,7 @@ int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix)
{
struct strvec sent_argv = STRVEC_INIT;
const char *arg_cmd = "argument ";
int ret;
if (argc != 2 || !strcmp(argv[1], "-h"))
usage(upload_archive_usage);
@ -46,8 +47,11 @@ int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix)
}
/* parse all options sent by the client */
return write_archive(sent_argv.nr, sent_argv.v, prefix,
the_repository, NULL, 1);
ret = write_archive(sent_argv.nr, sent_argv.v, prefix,
the_repository, NULL, 1);
strvec_clear(&sent_argv);
return ret;
}
__attribute__((format (printf, 1, 2)))

View file

@ -644,10 +644,8 @@ int unbundle(struct repository *r, struct bundle_header *header,
if (flags & VERIFY_BUNDLE_FSCK)
strvec_push(&ip.args, "--fsck-objects");
if (extra_index_pack_args) {
if (extra_index_pack_args)
strvec_pushv(&ip.args, extra_index_pack_args->v);
strvec_clear(extra_index_pack_args);
}
ip.in = bundle_fd;
ip.no_stdout = 1;

View file

@ -1371,6 +1371,9 @@ void reset_parsed_attributes(void)
for (drv = user_convert; drv; drv = next) {
next = drv->next;
free((void *)drv->name);
free((void *)drv->smudge);
free((void *)drv->clean);
free((void *)drv->process);
free(drv);
}
user_convert = NULL;

View file

@ -1292,8 +1292,21 @@ void clear_mailinfo(struct mailinfo *mi)
strbuf_release(&mi->inbody_header_accum);
free(mi->message_id);
strbuf_list_free(mi->p_hdr_data);
strbuf_list_free(mi->s_hdr_data);
for (size_t i = 0; header[i]; i++) {
if (!mi->p_hdr_data[i])
continue;
strbuf_release(mi->p_hdr_data[i]);
free(mi->p_hdr_data[i]);
}
free(mi->p_hdr_data);
for (size_t i = 0; header[i]; i++) {
if (!mi->s_hdr_data[i])
continue;
strbuf_release(mi->s_hdr_data[i]);
free(mi->s_hdr_data[i]);
}
free(mi->s_hdr_data);
while (mi->content < mi->content_top) {
free(*(mi->content_top));

View file

@ -1306,6 +1306,18 @@ static int write_midx_internal(const char *object_dir,
pack_name_concat_len += MIDX_CHUNK_ALIGNMENT -
(pack_name_concat_len % MIDX_CHUNK_ALIGNMENT);
if (ctx.nr - dropped_packs == 0) {
error(_("no pack files to index."));
result = 1;
goto cleanup;
}
if (!ctx.entries_nr) {
if (flags & MIDX_WRITE_BITMAP)
warning(_("refusing to write multi-pack .bitmap without any objects"));
flags &= ~(MIDX_WRITE_REV_INDEX | MIDX_WRITE_BITMAP);
}
if (ctx.incremental) {
struct strbuf lock_name = STRBUF_INIT;
@ -1331,18 +1343,6 @@ static int write_midx_internal(const char *object_dir,
f = hashfd(get_lock_file_fd(&lk), get_lock_file_path(&lk));
}
if (ctx.nr - dropped_packs == 0) {
error(_("no pack files to index."));
result = 1;
goto cleanup;
}
if (!ctx.entries_nr) {
if (flags & MIDX_WRITE_BITMAP)
warning(_("refusing to write multi-pack .bitmap without any objects"));
flags &= ~(MIDX_WRITE_REV_INDEX | MIDX_WRITE_BITMAP);
}
cf = init_chunkfile(f);
add_chunk(cf, MIDX_CHUNKID_PACKNAMES, pack_name_concat_len,

View file

@ -63,7 +63,7 @@ static int git_pretty_formats_config(const char *var, const char *value,
void *cb UNUSED)
{
struct cmt_fmt_map *commit_format = NULL;
const char *name;
const char *name, *stripped;
char *fmt;
int i;
@ -90,15 +90,21 @@ static int git_pretty_formats_config(const char *var, const char *value,
commit_formats_len++;
}
free((char *)commit_format->name);
commit_format->name = xstrdup(name);
commit_format->format = CMIT_FMT_USERFORMAT;
if (git_config_string(&fmt, var, value))
return -1;
if (skip_prefix(fmt, "format:", &commit_format->user_format)) {
free((char *)commit_format->user_format);
if (skip_prefix(fmt, "format:", &stripped)) {
commit_format->is_tformat = 0;
} else if (skip_prefix(fmt, "tformat:", &commit_format->user_format)) {
commit_format->user_format = xstrdup(stripped);
free(fmt);
} else if (skip_prefix(fmt, "tformat:", &stripped)) {
commit_format->is_tformat = 1;
commit_format->user_format = xstrdup(stripped);
free(fmt);
} else if (strchr(fmt, '%')) {
commit_format->is_tformat = 1;
commit_format->user_format = fmt;
@ -1770,6 +1776,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
}
trailer_out:
string_list_clear(&filter_list, 0);
strbuf_release(&kvsepbuf);
strbuf_release(&sepbuf);
return ret;
}

View file

@ -243,6 +243,17 @@ static struct branch *make_branch(struct remote_state *remote_state,
return ret;
}
static void branch_release(struct branch *branch)
{
free((char *)branch->name);
free((char *)branch->refname);
free(branch->remote_name);
free(branch->pushremote_name);
for (int i = 0; i < branch->merge_nr; i++)
refspec_item_clear(branch->merge[i]);
free(branch->merge);
}
static struct rewrite *make_rewrite(struct rewrites *r,
const char *base, size_t len)
{
@ -263,6 +274,14 @@ static struct rewrite *make_rewrite(struct rewrites *r,
return ret;
}
static void rewrites_release(struct rewrites *r)
{
for (int i = 0; i < r->rewrite_nr; i++)
free((char *)r->rewrite[i]->base);
free(r->rewrite);
memset(r, 0, sizeof(*r));
}
static void add_instead_of(struct rewrite *rewrite, const char *instead_of)
{
ALLOC_GROW(rewrite->instead_of, rewrite->instead_of_nr + 1, rewrite->instead_of_alloc);
@ -373,8 +392,10 @@ static int handle_config(const char *key, const char *value,
return -1;
branch = make_branch(remote_state, name, namelen);
if (!strcmp(subkey, "remote")) {
FREE_AND_NULL(branch->remote_name);
return git_config_string(&branch->remote_name, key, value);
} else if (!strcmp(subkey, "pushremote")) {
FREE_AND_NULL(branch->pushremote_name);
return git_config_string(&branch->pushremote_name, key, value);
} else if (!strcmp(subkey, "merge")) {
if (!value)
@ -406,9 +427,11 @@ static int handle_config(const char *key, const char *value,
return 0;
/* Handle remote.* variables */
if (!name && !strcmp(subkey, "pushdefault"))
if (!name && !strcmp(subkey, "pushdefault")) {
FREE_AND_NULL(remote_state->pushremote_name);
return git_config_string(&remote_state->pushremote_name, key,
value);
}
if (!name)
return 0;
@ -475,12 +498,15 @@ static int handle_config(const char *key, const char *value,
else if (!strcmp(value, "--tags"))
remote->fetch_tags = 2;
} else if (!strcmp(subkey, "proxy")) {
FREE_AND_NULL(remote->http_proxy);
return git_config_string(&remote->http_proxy,
key, value);
} else if (!strcmp(subkey, "proxyauthmethod")) {
FREE_AND_NULL(remote->http_proxy_authmethod);
return git_config_string(&remote->http_proxy_authmethod,
key, value);
} else if (!strcmp(subkey, "vcs")) {
FREE_AND_NULL(remote->foreign_vcs);
return git_config_string(&remote->foreign_vcs, key, value);
}
return 0;
@ -1318,18 +1344,21 @@ static int match_explicit(struct ref *src, struct ref *dst,
struct ref ***dst_tail,
struct refspec_item *rs)
{
struct ref *matched_src, *matched_dst;
int allocated_src;
struct ref *matched_src = NULL, *matched_dst = NULL;
int allocated_src = 0, ret;
const char *dst_value = rs->dst;
char *dst_guess;
if (rs->pattern || rs->matching || rs->negative)
return 0;
if (rs->pattern || rs->matching || rs->negative) {
ret = 0;
goto out;
}
matched_src = matched_dst = NULL;
if (match_explicit_lhs(src, rs, &matched_src, &allocated_src) < 0)
return -1;
if (match_explicit_lhs(src, rs, &matched_src, &allocated_src) < 0) {
ret = -1;
goto out;
}
if (!dst_value) {
int flag;
@ -1368,18 +1397,30 @@ static int match_explicit(struct ref *src, struct ref *dst,
dst_value);
break;
}
if (!matched_dst)
return -1;
if (matched_dst->peer_ref)
return error(_("dst ref %s receives from more than one src"),
matched_dst->name);
else {
if (!matched_dst) {
ret = -1;
goto out;
}
if (matched_dst->peer_ref) {
ret = error(_("dst ref %s receives from more than one src"),
matched_dst->name);
goto out;
} else {
matched_dst->peer_ref = allocated_src ?
matched_src :
copy_ref(matched_src);
matched_dst->force = rs->force;
matched_src = NULL;
}
return 0;
ret = 0;
out:
if (allocated_src)
free_one_ref(matched_src);
return ret;
}
static int match_explicit_refs(struct ref *src, struct ref *dst,
@ -2040,6 +2081,8 @@ static struct ref *get_expanded_map(const struct ref *remote_refs,
!ignore_symref_update(expn_name, &scratch)) {
struct ref *cpy = copy_ref(ref);
if (cpy->peer_ref)
free_one_ref(cpy->peer_ref);
cpy->peer_ref = alloc_ref(expn_name);
if (refspec->force)
cpy->peer_ref->force = 1;
@ -2797,16 +2840,26 @@ struct remote_state *remote_state_new(void)
void remote_state_clear(struct remote_state *remote_state)
{
struct hashmap_iter iter;
struct branch *b;
int i;
for (i = 0; i < remote_state->remotes_nr; i++)
remote_clear(remote_state->remotes[i]);
FREE_AND_NULL(remote_state->remotes);
FREE_AND_NULL(remote_state->pushremote_name);
remote_state->remotes_alloc = 0;
remote_state->remotes_nr = 0;
rewrites_release(&remote_state->rewrites);
rewrites_release(&remote_state->rewrites_push);
hashmap_clear_and_free(&remote_state->remotes_hash, struct remote, ent);
hashmap_clear_and_free(&remote_state->branches_hash, struct remote, ent);
hashmap_for_each_entry(&remote_state->branches_hash, &iter, b, ent) {
branch_release(b);
free(b);
}
hashmap_clear(&remote_state->branches_hash);
}
/*

View file

@ -32,28 +32,27 @@ static int use_sideband_colors(void)
const char *key = "color.remote";
struct strbuf sb = STRBUF_INIT;
char *value;
const char *value;
int i;
if (use_sideband_colors_cached >= 0)
return use_sideband_colors_cached;
if (!git_config_get_string(key, &value)) {
if (!git_config_get_string_tmp(key, &value))
use_sideband_colors_cached = git_config_colorbool(key, value);
} else if (!git_config_get_string("color.ui", &value)) {
else if (!git_config_get_string_tmp("color.ui", &value))
use_sideband_colors_cached = git_config_colorbool("color.ui", value);
} else {
else
use_sideband_colors_cached = GIT_COLOR_AUTO;
}
for (i = 0; i < ARRAY_SIZE(keywords); i++) {
strbuf_reset(&sb);
strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword);
if (git_config_get_string(sb.buf, &value))
continue;
if (color_parse(value, keywords[i].color))
if (git_config_get_string_tmp(sb.buf, &value))
continue;
color_parse(value, keywords[i].color);
}
strbuf_release(&sb);
return use_sideband_colors_cached;
}

View file

@ -86,6 +86,8 @@ static int read_midx_checksum(const char *object_dir)
if (!m)
return 1;
printf("%s\n", hash_to_hex(get_midx_checksum(m)));
close_midx(m);
return 0;
}
@ -102,10 +104,12 @@ static int read_midx_preferred_pack(const char *object_dir)
if (midx_preferred_pack(midx, &preferred_pack) < 0) {
warning(_("could not determine MIDX preferred pack"));
close_midx(midx);
return 1;
}
printf("%s\n", midx->pack_names[preferred_pack]);
close_midx(midx);
return 0;
}
@ -122,8 +126,10 @@ static int read_midx_bitmapped_packs(const char *object_dir)
return 1;
for (i = 0; i < midx->num_packs + midx->num_packs_in_base; i++) {
if (nth_bitmapped_pack(the_repository, midx, &pack, i) < 0)
if (nth_bitmapped_pack(the_repository, midx, &pack, i) < 0) {
close_midx(midx);
return 1;
}
printf("%s\n", pack_basename(pack.p));
printf(" bitmap_pos: %"PRIuMAX"\n", (uintmax_t)pack.bitmap_pos);

View file

@ -5,6 +5,7 @@ test_description='git am running'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup: messages' '

View file

@ -5,6 +5,8 @@
#
test_description='Test pretty formats'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Tested non-UTF-8 encoding

View file

@ -2,6 +2,7 @@
test_description='git merge-tree --write-tree'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This test is ort-specific

View file

@ -25,6 +25,7 @@ commit id embedding:
'
TEST_CREATE_REPO_NO_TEMPLATE=1
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
SUBSTFORMAT=%H%n

View file

@ -3,6 +3,7 @@
test_description='git archive --format=zip test'
TEST_CREATE_REPO_NO_TEMPLATE=1
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
SUBSTFORMAT=%H%n

View file

@ -5,6 +5,7 @@
test_description='git mailinfo and git mailsplit test'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
DATA="$TEST_DIRECTORY/t5100"

View file

@ -1,6 +1,8 @@
#!/bin/sh
test_description='multi-pack-indexes'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-chunk.sh
. "$TEST_DIRECTORY"/lib-midx.sh

View file

@ -9,6 +9,7 @@ test_description='See why rewinding head breaks send-pack
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cnt=64

View file

@ -4,6 +4,8 @@
#
test_description='Test the update hook infrastructure.'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '

View file

@ -1,6 +1,8 @@
#!/bin/sh
test_description='send-pack --stdin tests'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
create_ref () {

View file

@ -2,6 +2,7 @@
test_description='remote messages are colorized on the client'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '

View file

@ -4,6 +4,7 @@ test_description='fetch/push involving alternates'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
count_objects () {

View file

@ -2,6 +2,7 @@
test_description='git remote porcelain-ish'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
setup_repository () {

View file

@ -5,6 +5,7 @@ test_description='Per branch config variables affects "git fetch".
'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-bundle.sh

View file

@ -5,6 +5,7 @@ test_description='push to a repository that borrows from elsewhere'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '

View file

@ -2,6 +2,7 @@
test_description='fetch handles conflicting refspecs correctly'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
D=$(pwd)

View file

@ -4,6 +4,7 @@
#
test_description='Test git push porcelain output'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Create commits in <repo> and assign each commit's oid to shell variables

View file

@ -4,6 +4,7 @@ test_description='"git fetch/pull --set-upstream" basic tests.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_config () {

View file

@ -5,6 +5,7 @@ test_description='git fetch output format'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'fetch with invalid output format configuration' '

View file

@ -2,6 +2,7 @@
test_description='upload-pack ref-in-want'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
get_actual_refs () {

View file

@ -1,6 +1,8 @@
#!/bin/sh
test_description='test disabling of git-over-http in clone/fetch'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-proto-disable.sh"
. "$TEST_DIRECTORY/lib-httpd.sh"

View file

@ -7,6 +7,7 @@ test_description='Tests replace refs functionality'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"

View file

@ -2,6 +2,7 @@
test_description='git repack works correctly'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
objdir=.git/objects

View file

@ -189,6 +189,8 @@ static int fetch_refs_from_bundle(struct transport *transport,
&extra_index_pack_args,
fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0);
transport->hash_algo = data->header.hash_algo;
strvec_clear(&extra_index_pack_args);
return ret;
}
@ -945,7 +947,13 @@ static int disconnect_git(struct transport *transport)
finish_connect(data->conn);
}
if (data->options.negotiation_tips) {
oid_array_clear(data->options.negotiation_tips);
free(data->options.negotiation_tips);
}
list_objects_filter_release(&data->options.filter_options);
oid_array_clear(&data->extra_have);
oid_array_clear(&data->shallow);
free(data);
return 0;
}