Browse Source

[infer] Fix ObjectWalk leak in PackWriter.preparePack()

Change-Id: I5d2455404e507faa717e9d916e9b6cd80aa91473
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.7
Matthias Sohn 8 years ago
parent
commit
08480c948c
  1. 15
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

15
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

@ -745,14 +745,15 @@ public class PackWriter implements AutoCloseable {
@NonNull Set<? extends ObjectId> want,
@NonNull Set<? extends ObjectId> have,
@NonNull Set<? extends ObjectId> shallow) throws IOException {
ObjectWalk ow;
if (shallowPack) {
ow = new DepthWalk.ObjectWalk(reader, depth - 1);
} else {
ow = new ObjectWalk(reader);
try (ObjectWalk ow = getObjectWalk()) {
ow.assumeShallow(shallow);
preparePack(countingMonitor, ow, want, have);
}
ow.assumeShallow(shallow);
preparePack(countingMonitor, ow, want, have);
}
private ObjectWalk getObjectWalk() {
return shallowPack ? new DepthWalk.ObjectWalk(reader, depth - 1)
: new ObjectWalk(reader);
}
/**

Loading…
Cancel
Save