Skip to content

Commit 6760906

Browse files
committed
Assume DB backends have a free() function
Using git__free() in this case probably isn't safe and backend implementations really should be prepared to free themselves since we can't really know how they were allocated in the first place.
1 parent 0fb2464 commit 6760906

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/rugged/rugged_repo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ static void rugged_repo_new_with_backend(git_repository **repo, VALUE rb_path, V
216216

217217
error = git_odb_add_backend(odb, odb_backend, 1);
218218
if (error) {
219-
if (odb_backend->free) odb_backend->free(odb_backend);
220-
else git__free(odb_backend);
219+
assert(odb_backend->free);
220+
odb_backend->free(odb_backend);
221221
goto cleanup;
222222
}
223223

@@ -229,8 +229,8 @@ static void rugged_repo_new_with_backend(git_repository **repo, VALUE rb_path, V
229229

230230
error = backend->refdb_backend(&refdb_backend, backend, path);
231231
if (error) {
232-
if (refdb_backend->free) odb_backend->free(odb_backend);
233-
else git__free(refdb_backend);
232+
assert(refdb_backend->free);
233+
refdb_backend->free(refdb_backend);
234234
goto cleanup;
235235
}
236236

0 commit comments

Comments
 (0)