jettero/posix--regex — pull request #2 by wolfsage (2013-02-07 21:13:58+00:00)
Title: Don't SEGFAULT when regcomp fails. Also clean up memory if there's an

error in new().

There were various leaks if errors happened in POSIX::Regex->new() due
to regcomp() croaking out early without freeing the regex_t object.

Also, if the actual regcomp() call failed, both the regex_t pointer and
the created data structure wouldn't be freed.

I added "\n" to all of the croaks so the error messages are less
confusing/verbose, since they often pointed to code-paths in
POSIX::Regex instead of the caller.