Delete buffer array when releasing last buffer.

This commit is contained in:
Robert Reif 2004-08-16 19:59:54 +00:00 committed by Alexandre Julliard
parent eba298017d
commit 1d3c40d577
1 changed files with 4 additions and 0 deletions

View File

@ -404,6 +404,10 @@ static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) {
This->dsound->buffers = HeapReAlloc(GetProcessHeap(),0,This->dsound->buffers,sizeof(LPDIRECTSOUNDBUFFER8)*This->dsound->nrofbuffers); 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); 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)); RtlReleaseResource(&(This->dsound->lock));
DeleteCriticalSection(&(This->lock)); DeleteCriticalSection(&(This->lock));