bugfix: memleak in re_extract() function

Thanks to Pavel Levshin for reporting this problem.
bugfix: buffer overrun if re_extract function was called for submatch 50

Thanks to Pavel Levshin for reporting the problem and its location.
Merge branch 'v7-stable'