shithub: qk1

Download patch

ref: 6d2e17708cebe8da6d30db3a992beb7ce9a87cf2
parent: 140b307ed8b5f7681e2d0316fb1c867febb27d6c
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Dec 24 13:06:28 EST 2023

openal: free AL buffers when no longer needed

--- a/unix/snd_openal.c
+++ b/unix/snd_openal.c
@@ -147,6 +147,7 @@
 findsfx(char *s)
 {
 	Sfx *sfx, *e;
+	alsfx_t *b;
 
 	if(strlen(s) >= Npath)
 		Host_Error("findsfx: path too long %s", s);
@@ -166,8 +167,10 @@
 		}
 		if(sfx == e)
 			Host_Error("findsfx: sfx list overflow: %s", s);
-		if(Cache_Check(&sfx->cu))
+		if((b = Cache_Check(&sfx->cu)) != nil){
+			alDeleteBuffers(1, &b->buf); ALERR();
 			Cache_Free(&sfx->cu);
+		}
 	}else
 		num_sfx++;
 	strcpy(sfx->s, s);
@@ -515,6 +518,7 @@
 void
 sfxbegin(void)
 {
+	map++;
 }
 
 int