fixes #22868; fixes std/nre leaks under ARC/ORC (#22872)

fixes #22868
This commit is contained in:
ringabout
2023-10-27 13:32:10 +08:00
committed by GitHub
parent 0e45b01b21
commit d66f3febd1

View File

@@ -217,9 +217,11 @@ type
## code.
proc destroyRegex(pattern: Regex) =
`=destroy`(pattern.pattern)
pcre.free_substring(cast[cstring](pattern.pcreObj))
if pattern.pcreExtra != nil:
pcre.free_study(pattern.pcreExtra)
`=destroy`(pattern.captureNameToId)
proc getinfo[T](pattern: Regex, opt: cint): T =
let retcode = pcre.fullinfo(pattern.pcreObj, pattern.pcreExtra, opt, addr result)