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 /include/git2 | |
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 'include/git2')
-rw-r--r-- | include/git2/sys/odb_backend.h | 4 | ||||
-rw-r--r-- | include/git2/sys/refdb_backend.h | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h index fe102ff3c..e423a9236 100644 --- a/include/git2/sys/odb_backend.h +++ b/include/git2/sys/odb_backend.h @@ -83,6 +83,10 @@ struct git_odb_backend { git_odb_writepack **, git_odb_backend *, git_odb *odb, git_transfer_progress_cb progress_cb, void *progress_payload); + /** + * Frees any resources held by the odb (including the `git_odb_backend` + * itself). An odb backend implementation must provide this function. + */ void (* free)(git_odb_backend *); }; diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h index 01fce8009..5129ad84a 100644 --- a/include/git2/sys/refdb_backend.h +++ b/include/git2/sys/refdb_backend.h @@ -130,8 +130,8 @@ struct git_refdb_backend { int (*ensure_log)(git_refdb_backend *backend, const char *refname); /** - * Frees any resources held by the refdb. A refdb implementation may - * provide this function; if it is not provided, nothing will be done. + * Frees any resources held by the refdb (including the `git_refdb_backend` + * itself). A refdb backend implementation must provide this function. */ void (*free)(git_refdb_backend *backend); |