diff options
| author | Vicent Martà <vicent@github.com> | 2012-12-28 10:34:35 -0800 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-12-28 10:34:35 -0800 |
| commit | 3d4064a2cba57fca3f86c5b4d00051ab88f3760d (patch) | |
| tree | ccaf91016d5a9e4a8553fbd2f2221814289b97a8 /src/diff.c | |
| parent | 645e67e863a5369b7c02173f859371d89ac2389d (diff) | |
| parent | 3865f7f6610563864d8f7a2671229b6fd398cd1b (diff) | |
| download | libgit2-3d4064a2cba57fca3f86c5b4d00051ab88f3760d.tar.gz | |
Merge pull request #1176 from arrbee/fix-iter-memleak
Alternative fix for iterator memory leak
Diffstat (limited to 'src/diff.c')
| -rw-r--r-- | src/diff.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/diff.c b/src/diff.c index 9c0b45f8e..83e73cd03 100644 --- a/src/diff.c +++ b/src/diff.c @@ -589,18 +589,13 @@ int git_diff__from_iterators( goto fail; if (diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) { - /* If one of the iterators doesn't have ignore_case set, - * then that's unfortunate because we'll have to spool - * its data, sort it icase, and then use that for our - * merge join to the other iterator that is icase sorted */ - if (!old_iter->ignore_case && - git_iterator_spoolandsort( - &old_iter, old_iter, diff->entrycomp, true) < 0) - goto fail; - - if (!new_iter->ignore_case && - git_iterator_spoolandsort( - &new_iter, new_iter, diff->entrycomp, true) < 0) + /* If either iterator does not have ignore_case set, then we will + * spool its data, sort it icase, and use that for the merge join + * with the other iterator which was icase sorted. This call is + * a no-op on an iterator that already matches "ignore_case". + */ + if (git_iterator_spoolandsort_push(old_iter, true) < 0 || + git_iterator_spoolandsort_push(new_iter, true) < 0) goto fail; } |
