mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 06:20:56 +00:00
test: fix some memory leaks
This commit is contained in:
parent
fa5d94a0d4
commit
68206c54bf
12
src/fetch.c
12
src/fetch.c
@ -58,10 +58,11 @@ static int filter_wants(git_remote *remote)
|
|||||||
{
|
{
|
||||||
struct filter_payload p;
|
struct filter_payload p;
|
||||||
git_refspec tagspec;
|
git_refspec tagspec;
|
||||||
|
int error = -1;
|
||||||
|
|
||||||
git_vector_clear(&remote->refs);
|
git_vector_clear(&remote->refs);
|
||||||
if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
|
if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
|
||||||
return -1;
|
return error;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The fetch refspec can be NULL, and what this means is that the
|
* The fetch refspec can be NULL, and what this means is that the
|
||||||
@ -75,9 +76,14 @@ static int filter_wants(git_remote *remote)
|
|||||||
p.remote = remote;
|
p.remote = remote;
|
||||||
|
|
||||||
if (git_repository_odb__weakptr(&p.odb, remote->repo) < 0)
|
if (git_repository_odb__weakptr(&p.odb, remote->repo) < 0)
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
return git_remote_ls(remote, filter_ref__cb, &p);
|
error = git_remote_ls(remote, filter_ref__cb, &p);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
git_refspec__free(&tagspec);
|
||||||
|
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait until we get an ack from the */
|
/* Wait until we get an ack from the */
|
||||||
|
@ -93,6 +93,7 @@ static int send_request(transport_http *t, const char *service, void *data, ssiz
|
|||||||
#ifndef GIT_WINHTTP
|
#ifndef GIT_WINHTTP
|
||||||
git_buf request = GIT_BUF_INIT;
|
git_buf request = GIT_BUF_INIT;
|
||||||
const char *verb;
|
const char *verb;
|
||||||
|
int error = -1;
|
||||||
|
|
||||||
verb = ls ? "GET" : "POST";
|
verb = ls ? "GET" : "POST";
|
||||||
/* Generate and send the HTTP request */
|
/* Generate and send the HTTP request */
|
||||||
@ -102,17 +103,20 @@ static int send_request(transport_http *t, const char *service, void *data, ssiz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (gitno_send((git_transport *) t, request.ptr, request.size, 0) < 0) {
|
if (gitno_send((git_transport *) t, request.ptr, request.size, 0) < 0)
|
||||||
git_buf_free(&request);
|
goto cleanup;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content_length) {
|
if (content_length) {
|
||||||
if (gitno_send((git_transport *) t, data, content_length, 0) < 0)
|
if (gitno_send((git_transport *) t, data, content_length, 0) < 0)
|
||||||
return -1;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
error = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
git_buf_free(&request);
|
||||||
|
return error;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
wchar_t *verb;
|
wchar_t *verb;
|
||||||
wchar_t url[GIT_WIN_PATH], ct[GIT_WIN_PATH];
|
wchar_t url[GIT_WIN_PATH], ct[GIT_WIN_PATH];
|
||||||
|
@ -47,6 +47,8 @@ static void do_fetch(const char *url, int flag, int n)
|
|||||||
git_remote_disconnect(remote);
|
git_remote_disconnect(remote);
|
||||||
cl_git_pass(git_remote_update_tips(remote));
|
cl_git_pass(git_remote_update_tips(remote));
|
||||||
cl_assert_equal_i(counter, n);
|
cl_assert_equal_i(counter, n);
|
||||||
|
|
||||||
|
git_remote_free(remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_network_fetch__default_git(void)
|
void test_network_fetch__default_git(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user