shithub: mc

Download patch

ref: 52a5be5adc041a5dc8daa1238a1f307c728e75c8
parent: c61cd86ee5526546e3d36df566e72c1cca0424f7
author: Ori Bernstein <[email protected]>
date: Mon Nov 30 21:18:55 EST 2015

Fix memory leak.

	We weren't freeing the bit set.

--- a/lib/regex/interp.myr
+++ b/lib/regex/interp.myr
@@ -24,6 +24,7 @@
 	thr = run(re)
 	if thr != Zthr
 		m = getmatches(re, thr)
+		thrfree(re, thr)
 		cleanup(re)
 		-> `std.Some m
 	else
@@ -99,6 +100,7 @@
 			if thr.dead
 				thrfree(re, thr)
 			elif thr.matched && re.strp == re.str.len
+				std.bsfree(states)
 				-> thr
 			elif !thr.matched
 				std.bsput(states, thr.ip)
@@ -120,6 +122,7 @@
 		re.expiredtail = Zthr
 		re.strp++
 	;;
+	std.bsfree(states)
 	-> Zthr
 }