Skip to content

Commit 24cb2bf

Browse files
committed
File history walk: memory management
1 parent e3ed916 commit 24cb2bf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

generate/templates/manual/revwalk/file_history_walk.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ void GitRevwalk::FileHistoryWalkWorker::Execute()
352352
}
353353

354354
delete fileHistoryEvent;
355+
git_commit_free(parentCommit);
356+
git_tree_free(parentTree);
355357

356-
if (firstMatchingParentIndex.first) {
357-
git_commit_free(parentCommit);
358-
git_tree_free(parentTree);
358+
if (firstMatchingParentIndex.first) {
359359
break;
360360
}
361361
}
@@ -414,6 +414,8 @@ void GitRevwalk::FileHistoryWalkWorker::Execute()
414414
baton->out = NULL;
415415
baton->error = git_error_dup(git_error_last());
416416
}
417+
free((void *)baton->file_path);
418+
baton->file_path = NULL;
417419
}
418420

419421
void GitRevwalk::FileHistoryWalkWorker::HandleOKCallback()

0 commit comments

Comments
 (0)