SshTestGitServer: : ensure UploadPack is closed to fix resource leak

Change-Id: Ib766f1d56b3ca7940c593ebfe0ac68fc5028a11c
This commit is contained in:
Matthias Sohn 2022-11-20 21:33:17 +01:00
parent bde09c185f
commit 396508e283
1 changed files with 7 additions and 7 deletions

View File

@ -480,13 +480,13 @@ protected GitUploadPackCommand(String command,
@Override @Override
public void run() { public void run() {
UploadPack uploadPack = new UploadPack(repository); try (UploadPack uploadPack = new UploadPack(repository)) {
String gitProtocol = getEnvironment().getEnv().get("GIT_PROTOCOL"); String gitProtocol = getEnvironment().getEnv()
.get("GIT_PROTOCOL");
if (gitProtocol != null) { if (gitProtocol != null) {
uploadPack uploadPack.setExtraParameters(
.setExtraParameters(Collections.singleton(gitProtocol)); Collections.singleton(gitProtocol));
} }
try {
uploadPack.upload(getInputStream(), getOutputStream(), uploadPack.upload(getInputStream(), getOutputStream(),
getErrorStream()); getErrorStream());
onExit(0); onExit(0);