summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-05-13 14:07:36 +0000
committerhallgren <hallgren@chalmers.se>2014-05-13 14:07:36 +0000
commit121afca05a579def9c79536b5a3b658bc64aa0ac (patch)
tree877cafaff39f4e86ae1f49a676bddfb78fe9e7a7 /src/runtime/haskell-bind
parent7c9ff164bf89b6f39da5ad2c43f7772324e1c141 (diff)
Haskell binding: free memory pool to avoid space leak when readPGF fails
Diffstat (limited to 'src/runtime/haskell-bind')
-rw-r--r--src/runtime/haskell-bind/PGF2.hsc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc
index bff38ec92..42d49deb4 100644
--- a/src/runtime/haskell-bind/PGF2.hsc
+++ b/src/runtime/haskell-bind/PGF2.hsc
@@ -55,8 +55,10 @@ readPGF fpath =
if ty == gu_type__GuErrno
then do perrno <- (#peek GuExn, data.data) exn
errno <- peek perrno
+ gu_pool_free pool
ioError (errnoToIOError "readPGF" (Errno errno) Nothing (Just fpath))
- else throw (PGFError "The grammar cannot be loaded")
+ else do gu_pool_free pool
+ throw (PGFError "The grammar cannot be loaded")
else return pgf
master <- newForeignPtr gu_pool_finalizer pool
return PGF {pgf = pgf, pgfMaster = master}