diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2014-11-23 14:12:54 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-11-23 15:51:31 +0100 |
| commit | f7fcb18f8a7541bfc0228967fcbd916a9f515638 (patch) | |
| tree | ac2c6cb36f16206fdf2f6d6bb5b7904141aedd2d /src | |
| parent | e06b1040d703b4489f8280674e59b5245595c586 (diff) | |
| download | libgit2-f7fcb18f8a7541bfc0228967fcbd916a9f515638.tar.gz | |
Plug leaks
Valgrind is now clean except for libssl and libgcrypt.
Diffstat (limited to 'src')
| -rw-r--r-- | src/diff.c | 3 | ||||
| -rw-r--r-- | src/iterator.c | 1 | ||||
| -rw-r--r-- | src/remote.c | 1 | ||||
| -rw-r--r-- | src/transports/local.c | 20 |
4 files changed, 17 insertions, 8 deletions
diff --git a/src/diff.c b/src/diff.c index 89b3b77f3..1f3ee63be 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1234,7 +1234,7 @@ int git_diff_tree_to_workdir( assert(diff && repo); - if ((error = git_repository_index(&index, repo))) + if ((error = git_repository_index__weakptr(&index, repo))) return error; DIFF_FROM_ITERATORS( @@ -1243,7 +1243,6 @@ int git_diff_tree_to_workdir( &b, repo, index, old_tree, GIT_ITERATOR_DONT_AUTOEXPAND, pfx, pfx) ); - git_index_free(index); return error; } diff --git a/src/iterator.c b/src/iterator.c index d8a17a716..196adddbf 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -1418,6 +1418,7 @@ static void workdir_iterator__free(git_iterator *self) workdir_iterator *wi = (workdir_iterator *)self; if (wi->index) git_index_snapshot_release(&wi->index_snapshot, wi->index); + git_tree_free(wi->tree); fs_iterator__free(self); git_ignore__free(&wi->ignores); } diff --git a/src/remote.c b/src/remote.c index b1a84075e..0b00733dc 100644 --- a/src/remote.c +++ b/src/remote.c @@ -995,6 +995,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re error = remote_head_for_fetchspec_src(out, update_heads, git_buf_cstr(&remote_name)); cleanup: + git_buf_free(&remote_name); git_reference_free(resolved_ref); git_config_free(config); return error; diff --git a/src/transports/local.c b/src/transports/local.c index 05302a13f..c544fa935 100644 --- a/src/transports/local.c +++ b/src/transports/local.c @@ -47,6 +47,17 @@ static void free_head(git_remote_head *head) git__free(head); } +static void free_heads(git_vector *heads) +{ + git_remote_head *head; + size_t i; + + git_vector_foreach(heads, i, head) + free_head(head); + + git_vector_free(heads); +} + static int add_ref(transport_local *t, const char *name) { const char peeled[] = "^{}"; @@ -198,6 +209,8 @@ static int local_connect( if (t->connected) return 0; + free_heads(&t->refs); + t->url = git__strdup(url); GITERR_CHECK_ALLOC(t->url); t->direction = direction; @@ -624,13 +637,8 @@ static int local_close(git_transport *transport) static void local_free(git_transport *transport) { transport_local *t = (transport_local *)transport; - size_t i; - git_remote_head *head; - git_vector_foreach(&t->refs, i, head) - free_head(head); - - git_vector_free(&t->refs); + free_heads(&t->refs); /* Close the transport, if it's still open. */ local_close(transport); |
