From 7502ac484eb178bd8e97141a34ca4513e16ec44f Mon Sep 17 00:00:00 2001 From: Etienne Massip Date: Tue, 10 Jul 2012 20:16:07 +0000 Subject: [PATCH] Make sure that file handle is freed when an error is raised to prevent access exception on subsequent deletion attempt. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9970 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/plugins/rfpdf/lib/tcpdf.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plugins/rfpdf/lib/tcpdf.rb b/lib/plugins/rfpdf/lib/tcpdf.rb index 287e81bb7..83996bd09 100755 --- a/lib/plugins/rfpdf/lib/tcpdf.rb +++ b/lib/plugins/rfpdf/lib/tcpdf.rb @@ -2981,8 +2981,9 @@ class TCPDF if (colspace=='Indexed' and pal.empty?) Error('Missing palette in ' + file); end - f.close return {'w' => w, 'h' => h, 'cs' => colspace, 'bpc' => bpc, 'f'=>'FlateDecode', 'parms' => parms, 'pal' => pal, 'trns' => trns, 'data' => data} + ensure + f.close end #