pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1704703 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java
Date Tue, 22 Sep 2015 19:29:17 GMT
Author: tilman
Date: Tue Sep 22 19:29:13 2015
New Revision: 1704703

URL: http://svn.apache.org/viewvc?rev=1704703&view=rev
Log:
PDFBOX-2986: avoid potential resource leak pointed out by Tim Allison

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java?rev=1704703&r1=1704702&r2=1704703&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java Tue Sep 22 19:29:13
2015
@@ -81,7 +81,17 @@ public class TTFParser
      */
     public TrueTypeFont parse(File ttfFile) throws IOException
     {
-        return parse(new RAFDataStream(ttfFile, "r"));
+        TrueTypeFont ttf = null;
+        RAFDataStream raf = new RAFDataStream(ttfFile, "r");
+        try
+        {
+            ttf = parse(raf);
+        }
+        finally
+        {
+            raf.close();
+        }
+        return ttf;
     }
 
     /**



Mime
View raw message