diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-12-17 15:06:40 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-12-17 15:06:40 -0800 |
commit | 21127fa9829da1f7b805e44517970194490567d0 (patch) | |
tree | 88eaf57a33c0e0f73bacb984898a007698ca4ff9 /builtin | |
parent | Merge branch 'js/t7900-protect-pwd-in-config-get' (diff) | |
parent | upload-pack.c: don't free allowed_filters util pointers (diff) | |
download | tgif-21127fa9829da1f7b805e44517970194490567d0.tar.xz |
Merge branch 'tb/partial-clone-filters-fix'
Fix potential server side resource deallocation issues when
responding to a partial clone request.
* tb/partial-clone-filters-fix:
upload-pack.c: don't free allowed_filters util pointers
builtin/clone.c: don't ignore transport_fetch_refs() errors
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/clone.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index a0841923cf..a5630337e4 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -1293,8 +1293,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix) break; } - if (!is_local && !complete_refs_before_fetch) - transport_fetch_refs(transport, mapped_refs); + if (!is_local && !complete_refs_before_fetch) { + err = transport_fetch_refs(transport, mapped_refs); + if (err) + goto cleanup; + } remote_head = find_ref_by_name(refs, "HEAD"); remote_head_points_at = @@ -1339,8 +1342,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix) if (is_local) clone_local(path, git_dir); - else if (refs && complete_refs_before_fetch) - transport_fetch_refs(transport, mapped_refs); + else if (refs && complete_refs_before_fetch) { + err = transport_fetch_refs(transport, mapped_refs); + if (err) + goto cleanup; + } update_remote_refs(refs, mapped_refs, remote_head_points_at, branch_top.buf, reflog_msg.buf, transport, @@ -1367,6 +1373,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) junk_mode = JUNK_LEAVE_REPO; err = checkout(submodule_progress); +cleanup: free(remote_name); strbuf_release(&reflog_msg); strbuf_release(&branch_top); |