Skip to content

Commit 4a34f3b

Browse files
committed
Added git_diff_delta_dup to git_diff_get_patch to fix a memory issue when accessing DiffList patches.
1 parent 83abd4b commit 4a34f3b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/diff_list.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ Handle<Value> GitDiffList::Patch(const Arguments& args) {
211211
toReturn->Set(String::NewSymbol("patch"), to);
212212

213213
if (delta_out != NULL) {
214+
delta_out = (const git_diff_delta * )git_diff_delta_dup(delta_out);
215+
}
216+
if (delta_out != NULL) {
214217
to = GitDelta::New((void *)delta_out);
215218
} else {
216219
to = Null();

v0.18.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,7 @@
36893689
"name": "delta_out",
36903690
"jsName": "delta",
36913691
"cType": "const git_diff_delta **",
3692+
"copy": "git_diff_delta_dup",
36923693
"cppClassName": "GitDelta",
36933694
"jsClassName": "Delta",
36943695
"isReturn": true,

0 commit comments

Comments
 (0)