Multiple finalizers in wrapCompile causes segfault
Status: Beta
Brought to you by:
laboratoryman
wrapCompile in Text.Regex.Posix.Wrap uses mallocForeignPtrBytes to create a foreign pointer (which implicitly assigns a finalizer), but also explicitly assigns a finalizer via addForeignPtrFinalizer, causing a double-free to occur, leading to an occasional segfault. Removing the line "addForeignPtrFinalizer c_regfree regex_fptr" fixes the problem.