Unverified Commit d900dde4 by Patrick Steinhardt Committed by GitHub

Merge pull request #4988 from lhchavez/fix-improbable-odb-initialization-leak

Fix a _very_ improbable memory leak in git_odb_new()
parents cb150e60 dd45539d
...@@ -443,8 +443,12 @@ int git_odb_new(git_odb **out) ...@@ -443,8 +443,12 @@ int git_odb_new(git_odb **out)
git_odb *db = git__calloc(1, sizeof(*db)); git_odb *db = git__calloc(1, sizeof(*db));
GIT_ERROR_CHECK_ALLOC(db); GIT_ERROR_CHECK_ALLOC(db);
if (git_cache_init(&db->own_cache) < 0 || if (git_cache_init(&db->own_cache) < 0) {
git_vector_init(&db->backends, 4, backend_sort_cmp) < 0) { git__free(db);
return -1;
}
if (git_vector_init(&db->backends, 4, backend_sort_cmp) < 0) {
git_cache_free(&db->own_cache);
git__free(db); git__free(db);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment