mirror of
https://github.com/git/git
synced 2024-11-05 04:53:18 +00:00
97613b9cb9
When initializing the transport helper in `transport_get()`, we allocate the name of the helper. We neither end up transferring ownership of the name, nor do we free it. The associated memory thus leaks. Fix this memory leak by freeing the string at the calling side in `transport_get()`. `transport_helper_init()` now creates its own copy of the string and thus can free it as required. An alterantive way to fix this would be to transfer ownership of the string passed into `transport_helper_init()`, which would avoid the call to xstrdup(1). But it does make for a more surprising calling convention as we do not typically transfer ownership of strings like this. Mark now-passing tests as leak free. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
30 lines
834 B
Bash
Executable file
30 lines
834 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='test GIT_CURL_VERBOSE'
|
|
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-httpd.sh
|
|
start_httpd
|
|
|
|
test_expect_success 'setup repository' '
|
|
mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
|
|
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" --bare init &&
|
|
git config push.default matching &&
|
|
echo content >file &&
|
|
git add file &&
|
|
git commit -m one &&
|
|
git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
|
|
git push public main:main
|
|
'
|
|
|
|
test_expect_success 'failure in git-upload-pack is shown' '
|
|
test_might_fail env GIT_CURL_VERBOSE=1 \
|
|
git clone "$HTTPD_URL/error_git_upload_pack/smart/repo.git" \
|
|
2>curl_log &&
|
|
grep "<= Recv header: HTTP/1.1 500 Intentional Breakage" curl_log
|
|
'
|
|
|
|
test_done
|