regcomp: don't attach the regfree finalizer if c_regcomp failed.
r <- withCString pattern $ \cstr ->
withForeignPtr regex_fptr $ \p ->
c_regcomp p cstr (fromIntegral flags)
r <- withCString pattern $ \cstr ->
withForeignPtr regex_fptr $ \p ->
c_regcomp p cstr (fromIntegral flags)
- addForeignPtrFinalizer regex_fptr ptr_regfree
- then return (Regex regex_fptr)
+ then do addForeignPtrFinalizer regex_fptr ptr_regfree
+ return (Regex regex_fptr)
else error "Text.Regex.Posix.regcomp: error in pattern" -- ToDo
-- -----------------------------------------------------------------------------
else error "Text.Regex.Posix.regcomp: error in pattern" -- ToDo
-- -----------------------------------------------------------------------------