Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b0d74e6b
Commit
b0d74e6b
authored
Jan 24, 2005
by
Robert Reif
Committed by
Alexandre Julliard
Jan 24, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed memory leak in mixer code.
parent
9f625c5e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
17 deletions
+19
-17
dsound.c
dlls/dsound/dsound.c
+3
-0
dsound_private.h
dlls/dsound/dsound_private.h
+2
-0
mixer.c
dlls/dsound/mixer.c
+14
-17
No files found.
dlls/dsound/dsound.c
View file @
b0d74e6b
...
...
@@ -301,6 +301,7 @@ static ULONG WINAPI IDirectSoundImpl_Release(
if
(
This
->
driver
)
IDsDriver_Release
(
This
->
driver
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
tmp_buffer
);
RtlDeleteResource
(
&
This
->
buffer_list_lock
);
This
->
mixlock
.
DebugInfo
->
Spare
[
1
]
=
0
;
DeleteCriticalSection
(
&
This
->
mixlock
);
...
...
@@ -809,6 +810,8 @@ HRESULT WINAPI IDirectSoundImpl_Create(
pDS
->
primary
=
NULL
;
pDS
->
speaker_config
=
DSSPEAKER_STEREO
|
(
DSSPEAKER_GEOMETRY_NARROW
<<
16
);
pDS
->
initialized
=
FALSE
;
pDS
->
tmp_buffer
=
NULL
;
pDS
->
tmp_buffer_len
=
0
;
/* 3D listener initial parameters */
pDS
->
listener
=
NULL
;
...
...
dlls/dsound/dsound_private.h
View file @
b0d74e6b
...
...
@@ -95,6 +95,8 @@ struct IDirectSoundImpl
DSBUFFERDESC
dsbd
;
DWORD
speaker_config
;
BOOL
initialized
;
LPBYTE
tmp_buffer
;
DWORD
tmp_buffer_len
;
/* DirectSound3DListener fields */
IDirectSound3DListenerImpl
*
listener
;
...
...
dlls/dsound/mixer.c
View file @
b0d74e6b
...
...
@@ -368,20 +368,20 @@ static void DSOUND_MixerVol(IDirectSoundBufferImpl *dsb, BYTE *buf, INT len)
}
}
static
void
*
tmp_buffer
;
static
size_t
tmp_buffer_len
=
0
;
static
void
*
DSOUND_tmpbuffer
(
size_t
len
)
static
LPBYTE
DSOUND_tmpbuffer
(
IDirectSoundImpl
*
dsound
,
DWORD
len
)
{
if
(
len
>
tmp_buffer_len
)
{
void
*
new_buffer
=
realloc
(
tmp_buffer
,
len
);
if
(
new_buffer
)
{
tmp_buffer
=
new_buffer
;
tmp_buffer_len
=
len
;
TRACE
(
"(%p,%ld)
\n
"
,
dsound
,
len
);
if
(
len
>
dsound
->
tmp_buffer_len
)
{
if
(
dsound
->
tmp_buffer
)
dsound
->
tmp_buffer
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dsound
->
tmp_buffer
,
len
);
else
dsound
->
tmp_buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
dsound
->
tmp_buffer_len
=
len
;
}
return
new_buffer
;
}
return
tmp_buffer
;
return
dsound
->
tmp_buffer
;
}
static
DWORD
DSOUND_MixInBuffer
(
IDirectSoundBufferImpl
*
dsb
,
DWORD
writepos
,
DWORD
fraglen
)
...
...
@@ -407,9 +407,7 @@ static DWORD DSOUND_MixInBuffer(IDirectSoundBufferImpl *dsb, DWORD writepos, DWO
return
0
;
}
/* Been seeing segfaults in malloc() for some reason... */
TRACE
(
"allocating buffer (size = %d)
\n
"
,
len
);
if
((
buf
=
ibuf
=
(
BYTE
*
)
DSOUND_tmpbuffer
(
len
))
==
NULL
)
if
((
buf
=
ibuf
=
DSOUND_tmpbuffer
(
dsb
->
dsound
,
len
))
==
NULL
)
return
0
;
TRACE
(
"MixInBuffer (%p) len = %d, dest = %ld
\n
"
,
dsb
,
len
,
writepos
);
...
...
@@ -518,8 +516,7 @@ static void DSOUND_PhaseCancel(IDirectSoundBufferImpl *dsb, DWORD writepos, DWOR
nBlockAlign
=
dsb
->
dsound
->
pwfx
->
nBlockAlign
;
len
=
len
/
nBlockAlign
*
nBlockAlign
;
/* data alignment */
TRACE
(
"allocating buffer (size = %ld)
\n
"
,
len
);
if
((
buf
=
ibuf
=
(
BYTE
*
)
DSOUND_tmpbuffer
(
len
))
==
NULL
)
if
((
buf
=
ibuf
=
DSOUND_tmpbuffer
(
dsb
->
dsound
,
len
))
==
NULL
)
return
;
TRACE
(
"PhaseCancel (%p) len = %ld, dest = %ld
\n
"
,
dsb
,
len
,
writepos
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment