Commits

Anonymous committed a985f90

Use with-open to close the new FileInputStream in the digest method taking a File as an argument.

I don't know how to write a test for the file descriptor leak -- without looking at a /proc filesystem,
or parsing the output of lsof.

I've tested this at the REPL and it works (and fixes a nasty file descriptor leak in my own program).

Comments (0)

Files changed (1)

   (digest algorithm [message]))
 
 (defmethod digest File [algorithm ^File file]
-  (digest algorithm (FileInputStream. file)))
+  (with-open [f (FileInputStream. file)]
+    (digest algorithm f)))
 
 (defmethod digest InputStream [algorithm ^InputStream reader]
   (digest algorithm (byte-seq reader)))