mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-25 10:48:54 -06:00
the unmarshaller should not be disposed twice in case of error
This commit is contained in:
@@ -70,11 +70,9 @@ readPGF fpath =
|
|||||||
then do fptr <- newForeignPtr pgf_free_fptr c_pgf
|
then do fptr <- newForeignPtr pgf_free_fptr c_pgf
|
||||||
return (PGF fptr Map.empty)
|
return (PGF fptr Map.empty)
|
||||||
else if ex_type == (#const PGF_EXN_SYSTEM_ERROR)
|
else if ex_type == (#const PGF_EXN_SYSTEM_ERROR)
|
||||||
then do freeUnmarshaller u
|
then do errno <- (#peek PgfExn, code) c_exn
|
||||||
errno <- (#peek PgfExn, code) c_exn
|
|
||||||
ioError (errnoToIOError "readPGF" (Errno errno) Nothing (Just fpath))
|
ioError (errnoToIOError "readPGF" (Errno errno) Nothing (Just fpath))
|
||||||
else do freeUnmarshaller u
|
else do c_msg <- (#peek PgfExn, msg) c_exn
|
||||||
c_msg <- (#peek PgfExn, msg) c_exn
|
|
||||||
msg <- peekCString c_msg
|
msg <- peekCString c_msg
|
||||||
free c_msg
|
free c_msg
|
||||||
throwIO (PGFError msg)
|
throwIO (PGFError msg)
|
||||||
@@ -96,11 +94,9 @@ bootNGF pgf_path ngf_path =
|
|||||||
then do fptr <- newForeignPtr pgf_free_fptr c_pgf
|
then do fptr <- newForeignPtr pgf_free_fptr c_pgf
|
||||||
return (PGF fptr Map.empty)
|
return (PGF fptr Map.empty)
|
||||||
else if ex_type == (#const PGF_EXN_SYSTEM_ERROR)
|
else if ex_type == (#const PGF_EXN_SYSTEM_ERROR)
|
||||||
then do freeUnmarshaller u
|
then do errno <- (#peek PgfExn, code) c_exn
|
||||||
errno <- (#peek PgfExn, code) c_exn
|
|
||||||
ioError (errnoToIOError "bootNGF" (Errno errno) Nothing (Just pgf_path))
|
ioError (errnoToIOError "bootNGF" (Errno errno) Nothing (Just pgf_path))
|
||||||
else do freeUnmarshaller u
|
else do c_msg <- (#peek PgfExn, msg) c_exn
|
||||||
c_msg <- (#peek PgfExn, msg) c_exn
|
|
||||||
msg <- peekCString c_msg
|
msg <- peekCString c_msg
|
||||||
free c_msg
|
free c_msg
|
||||||
throwIO (PGFError msg)
|
throwIO (PGFError msg)
|
||||||
@@ -121,11 +117,9 @@ readNGF fpath =
|
|||||||
then do fptr <- newForeignPtr pgf_free_fptr c_pgf
|
then do fptr <- newForeignPtr pgf_free_fptr c_pgf
|
||||||
return (PGF fptr Map.empty)
|
return (PGF fptr Map.empty)
|
||||||
else if ex_type == (#const PGF_EXN_SYSTEM_ERROR)
|
else if ex_type == (#const PGF_EXN_SYSTEM_ERROR)
|
||||||
then do freeUnmarshaller u
|
then do errno <- (#peek PgfExn, code) c_exn
|
||||||
errno <- (#peek PgfExn, code) c_exn
|
|
||||||
ioError (errnoToIOError "readPGF" (Errno errno) Nothing (Just fpath))
|
ioError (errnoToIOError "readPGF" (Errno errno) Nothing (Just fpath))
|
||||||
else do freeUnmarshaller u
|
else do c_msg <- (#peek PgfExn, msg) c_exn
|
||||||
c_msg <- (#peek PgfExn, msg) c_exn
|
|
||||||
msg <- peekCString c_msg
|
msg <- peekCString c_msg
|
||||||
free c_msg
|
free c_msg
|
||||||
throwIO (PGFError msg)
|
throwIO (PGFError msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user