]> source.dussan.org Git - jgit.git/commitdiff
Fix DeltaWindow.clear() to release loaded buffer bytes. 10/9010/2
authorColby Ranger <cranger@google.com>
Mon, 3 Dec 2012 20:23:14 +0000 (12:23 -0800)
committerColby Ranger <cranger@google.com>
Mon, 3 Dec 2012 20:46:53 +0000 (12:46 -0800)
It is possible for the buffer to be set but not the index. It
ocurrs when an exception occurs during creating an index, but
after the buffer is loaded. Furthermore, the cleared DeltaWindowEntry
should have been ent and not res.

Change-Id: I2e0d79540316635bf7aa43efd225e4eb38230844

org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindow.java

index fead2147bf622e3e9245e22130cfad3e943bba2a..c51cafcbf2be2f04bd2307f6e61d23ed26ea4e92 100644 (file)
@@ -167,7 +167,7 @@ class DeltaWindow {
        private void clear(DeltaWindowEntry ent) {
                if (ent.index != null)
                        loaded -= ent.index.getIndexSize();
-               else if (res.buffer != null)
+               else if (ent.buffer != null)
                        loaded -= ent.buffer.length;
                ent.set(null);
        }