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:
24
midx-write.c
24
midx-write.c
@ -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,
|
||||
|
Reference in New Issue
Block a user