dsound fix memory leak

Robert Reif reif at earthlink.net
Sun Aug 15 21:17:30 CDT 2004


Delete buffer array when releasing last buffer.
-------------- next part --------------
Index: dlls/dsound/buffer.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/buffer.c,v
retrieving revision 1.29
diff -u -r1.29 buffer.c
--- dlls/dsound/buffer.c	12 Aug 2004 23:00:58 -0000	1.29
+++ dlls/dsound/buffer.c	16 Aug 2004 02:15:08 -0000
@@ -404,6 +404,10 @@
 		This->dsound->buffers = HeapReAlloc(GetProcessHeap(),0,This->dsound->buffers,sizeof(LPDIRECTSOUNDBUFFER8)*This->dsound->nrofbuffers);
 		TRACE("(%p) buffer count is now %d\n", This, This->dsound->nrofbuffers);
 	}
+	if (This->dsound->nrofbuffers == 0) {
+		HeapFree(GetProcessHeap(),0,This->dsound->buffers);
+		This->dsound->buffers = NULL;
+        }
 	RtlReleaseResource(&(This->dsound->lock));
 
 	DeleteCriticalSection(&(This->lock));


More information about the wine-patches mailing list