diff options
| author | lhchavez <lhchavez@lhchavez.com> | 2019-02-16 19:55:30 -0800 |
|---|---|---|
| committer | lhchavez <lhchavez@lhchavez.com> | 2019-02-20 06:31:38 -0800 |
| commit | 6b3730d4b997e979c7578bf5c2da3c33aa89b023 (patch) | |
| tree | 52d86ef99ce20c7aedaa352183faa922c98ecda8 /tests/odb | |
| parent | 12c6e1facc1b7644ed2c51df35625b36bad92340 (diff) | |
| download | libgit2-6b3730d4b997e979c7578bf5c2da3c33aa89b023.tar.gz | |
Fix a memory leak in odb_otype_fast()
This change frees a copy of a cached object in odb_otype_fast().
Diffstat (limited to 'tests/odb')
| -rw-r--r-- | tests/odb/mixed.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/odb/mixed.c b/tests/odb/mixed.c index ba2b2acb7..87e945c83 100644 --- a/tests/odb/mixed.c +++ b/tests/odb/mixed.c @@ -263,3 +263,24 @@ void test_odb_mixed__expand_ids(void) git__free(ids); } +void test_odb_mixed__expand_ids_cached(void) +{ + git_odb_expand_id *ids; + size_t i, num; + + /* test looking for the actual (correct) types after accessing the object */ + + setup_prefix_query(&ids, &num); + + for (i = 0; i < num; i++) { + git_odb_object *obj; + if (ids[i].type == GIT_OBJECT_ANY) + continue; + cl_git_pass(git_odb_read_prefix(&obj, _odb, &ids[i].id, ids[i].length)); + git_odb_object_free(obj); + } + + cl_git_pass(git_odb_expand_ids(_odb, ids, num)); + assert_found_objects(ids); + git__free(ids); +} |
