diff --git a/changelog.html b/changelog.html
index 1e4b36092a..2955748ae5 100644
--- a/changelog.html
+++ b/changelog.html
@@ -61,6 +61,9 @@ Upcoming changes
“Projects tied to slave” shows unrelated Maven module jobs.
(issue 17451)
+
+ Fixed file descriptor leak in fingerprint computation.
+ (issue 18351)
Added a new extension point to monitor the flow of stuff in the queue.
diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java
index ecd2b97ce5..a81ea7772a 100644
--- a/core/src/main/java/hudson/FilePath.java
+++ b/core/src/main/java/hudson/FilePath.java
@@ -1664,7 +1664,12 @@ public final class FilePath implements Serializable {
return act(new FileCallable() {
private static final long serialVersionUID = 1L;
public String invoke(File f, VirtualChannel channel) throws IOException {
- return Util.getDigestOf(new BufferedInputStream(new FileInputStream(f)));
+ BufferedInputStream source = new BufferedInputStream(new FileInputStream(f));
+ try {
+ return Util.getDigestOf(source);
+ } finally {
+ source.close();
+ }
}
});
}