mirror of https://github.com/odrling/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
3782b906d7
commit
42552e5efb
|
@ -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 New Issue