Skip to content

Commit

Permalink
Keepalive repl in replaceAll (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
itaischwartz authored Jun 4, 2024
1 parent adf8a27 commit 38fdd8d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/re2.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ func (re *Regexp) replaceAll(alloc *allocation, srcCSPtr pointer, repl []byte) (
res, matched := globalReplace(re, srcCSPtr.ptr, replCSPtr.ptr)

runtime.KeepAlive(re) // don't allow finalizer to run during method
runtime.KeepAlive(repl)

if !matched {
return nil, false
Expand Down

0 comments on commit 38fdd8d

Please sign in to comment.