regexec.c: avoid leaks on out-of-memory failure paths