shithub: femtolisp

Download patch

ref: a481e19ad53fab8fc086cdab088f513488a291da
parent: da0d11ebf1f9bce6672a14ff4a7ab9d851be85f1
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Jan 5 22:47:41 EST 2025

libmp: tests: don't leak

--- a/3rd/mp/test/ld.c
+++ b/3rd/mp/test/ld.c
@@ -538,12 +538,15 @@
 {
 	uint32_t j, state;
 	uint32_t r = 0;
+	ldint *b;
 
 	if(i < 257)
 		itold(i-128, a);
-	else if(i < 514)
-		pow2told(i-385, a);
-	else{
+	else if(i < 514){
+		b = pow2told(i-385, a);
+		if(a == nil)
+			ldfree(b);
+	}else{
 		state = i;
 		xorshift(&state);
 		xorshift(&state);