mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 12:49:08 -04:00
refactor!: use Finalizer
to automatically free allocated memory for objects (#48)
BREAKING CHANGE: signature change for remote and repository callbacks during repository clone operation.
This commit is contained in:
parent
94c40f9a94
commit
a3213a88a2
103 changed files with 2278 additions and 2595 deletions
|
@ -14,7 +14,12 @@ import 'package:libgit2dart/src/util.dart';
|
|||
Pointer<git_index> newInMemory() {
|
||||
final out = calloc<Pointer<git_index>>();
|
||||
libgit2.git_index_new(out);
|
||||
return out.value;
|
||||
|
||||
final result = out.value;
|
||||
|
||||
calloc.free(out);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Read index capabilities flags.
|
||||
|
@ -266,6 +271,8 @@ void addFromBuffer({
|
|||
buffer.length,
|
||||
);
|
||||
|
||||
calloc.free(bufferC);
|
||||
|
||||
if (error < 0) {
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
}
|
||||
|
@ -452,12 +459,12 @@ List<Map<String, Pointer<git_index_entry>>> conflictList(
|
|||
'our': ourOut.value,
|
||||
'their': theirOut.value,
|
||||
});
|
||||
calloc.free(ancestorOut);
|
||||
calloc.free(ourOut);
|
||||
calloc.free(theirOut);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
calloc.free(ancestorOut);
|
||||
calloc.free(ourOut);
|
||||
calloc.free(theirOut);
|
||||
}
|
||||
|
||||
libgit2.git_index_conflict_iterator_free(iterator.value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue