forked from mia/Aegisub
Correctly handle memory free using Lua GC
Instead of manually free. Otherwise return value of `search' may refer to invalid memory. Fix Aegisub/Aegisub#99
This commit is contained in:
parent
657d9d5149
commit
69310d40ae
1 changed files with 1 additions and 1 deletions
|
@ -39,7 +39,7 @@ search = (re, str, start) ->
|
|||
res = regex.search re, str, str\len(), start
|
||||
return unless res != nil
|
||||
first, last = res[0], res[1]
|
||||
ffi.C.free res
|
||||
ffi.gc(res, ffi.C.free)
|
||||
first, last
|
||||
|
||||
replace = (re, replacement, str, max_count) ->
|
||||
|
|
Loading…
Reference in a new issue