diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2020-11-21 22:54:26 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-11-27 11:09:20 +0000 |
| commit | 69fb897915fc56ba14c2a5e35fb55000732817b7 (patch) | |
| tree | 920841604a007b11186a16b9ca40733d7f3166ab /src | |
| parent | f16f2927879c9a2193d575f655ecd110508313df (diff) | |
| download | libgit2-69fb897915fc56ba14c2a5e35fb55000732817b7.tar.gz | |
midx: use GIT_ASSERT
Diffstat (limited to 'src')
| -rw-r--r-- | src/midx.c | 11 | ||||
| -rw-r--r-- | src/midx.h | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/midx.c b/src/midx.c index 21cfff497..00d73153d 100644 --- a/src/midx.c +++ b/src/midx.c @@ -181,7 +181,7 @@ int git_midx_parse( chunk_object_offsets = {0}, chunk_object_large_offsets = {0}; - assert(idx); + GIT_ASSERT_ARG(idx); if (size < sizeof(struct git_midx_header) + 20) return midx_error("multi-pack index is too short"); @@ -338,7 +338,7 @@ int git_midx_entry_find( const unsigned char *object_offset; off64_t offset; - assert(idx); + GIT_ASSERT_ARG(idx); hi = ntohl(idx->oid_fanout[(int)short_oid->id[0]]); lo = ((short_oid->id[0] == 0x0) ? 0 : ntohl(idx->oid_fanout[(int)short_oid->id[0] - 1])); @@ -399,13 +399,16 @@ int git_midx_entry_find( return 0; } -void git_midx_close(git_midx_file *idx) +int git_midx_close(git_midx_file *idx) { - assert(idx); + GIT_ASSERT_ARG(idx); if (idx->index_map.data) git_futils_mmap_free(&idx->index_map); + git_vector_free(&idx->packfile_names); + + return 0; } void git_midx_free(git_midx_file *idx) diff --git a/src/midx.h b/src/midx.h index e6a64cd81..3b802952c 100644 --- a/src/midx.h +++ b/src/midx.h @@ -71,7 +71,7 @@ int git_midx_entry_find( git_midx_file *idx, const git_oid *short_oid, size_t len); -void git_midx_close(git_midx_file *idx); +int git_midx_close(git_midx_file *idx); void git_midx_free(git_midx_file *idx); /* This is exposed for use in the fuzzers. */ |
