diff options
| author | Arthur Schreiber <schreiber.arthur@googlemail.com> | 2015-10-01 00:50:37 +0200 |
|---|---|---|
| committer | Arthur Schreiber <schreiber.arthur@googlemail.com> | 2015-10-01 00:50:37 +0200 |
| commit | d3b29fb94bf1c1d0caec39b4a2c3d2061c63efec (patch) | |
| tree | 2b8c5a5972d066c3c059d58b72e35ffa25511b1f /src/refdb.c | |
| parent | ba1a5553e43c7d5853dda21b1fce2a32e0ce4fd2 (diff) | |
| download | libgit2-d3b29fb94bf1c1d0caec39b4a2c3d2061c63efec.tar.gz | |
refdb and odb backends must provide `free` function
As refdb and odb backends can be allocated by client code, libgit2
can’t know whether an alternative memory allocator was used, and thus
should not try to call `git__free` on those objects.
Instead, odb and refdb backend implementations must always provide
their own `free` functions to ensure memory gets freed correctly.
Diffstat (limited to 'src/refdb.c')
| -rw-r--r-- | src/refdb.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/refdb.c b/src/refdb.c index 16fb519a6..debba1276 100644 --- a/src/refdb.c +++ b/src/refdb.c @@ -61,12 +61,8 @@ int git_refdb_open(git_refdb **out, git_repository *repo) static void refdb_free_backend(git_refdb *db) { - if (db->backend) { - if (db->backend->free) - db->backend->free(db->backend); - else - git__free(db->backend); - } + if (db->backend) + db->backend->free(db->backend); } int git_refdb_set_backend(git_refdb *db, git_refdb_backend *backend) |
