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
de133ae0
Commit
de133ae0
authored
Oct 04, 2009
by
Jörg Höhle
Committed by
Alexandre Julliard
Oct 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Correct deallocations when DuplicateSoundBuffer fails.
parent
dc3471ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
buffer.c
dlls/dsound/buffer.c
+12
-14
No files found.
dlls/dsound/buffer.c
View file @
de133ae0
...
@@ -1177,15 +1177,20 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
...
@@ -1177,15 +1177,20 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
HRESULT
hres
=
DS_OK
;
HRESULT
hres
=
DS_OK
;
TRACE
(
"(%p,%p,%p)
\n
"
,
device
,
pdsb
,
pdsb
);
TRACE
(
"(%p,%p,%p)
\n
"
,
device
,
pdsb
,
pdsb
);
dsb
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
dsb
));
dsb
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
dsb
));
if
(
dsb
==
NULL
)
{
if
(
dsb
==
NULL
)
{
WARN
(
"out of memory
\n
"
);
WARN
(
"out of memory
\n
"
);
*
ppdsb
=
NULL
;
*
ppdsb
=
NULL
;
return
DSERR_OUTOFMEMORY
;
return
DSERR_OUTOFMEMORY
;
}
}
CopyMemory
(
dsb
,
pdsb
,
sizeof
(
*
dsb
));
CopyMemory
(
dsb
,
pdsb
,
sizeof
(
IDirectSoundBufferImpl
));
dsb
->
pwfx
=
DSOUND_CopyFormat
(
pdsb
->
pwfx
);
if
(
dsb
->
pwfx
==
NULL
)
{
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
*
ppdsb
=
NULL
;
return
DSERR_OUTOFMEMORY
;
}
if
(
pdsb
->
hwbuf
)
{
if
(
pdsb
->
hwbuf
)
{
TRACE
(
"duplicating hardware buffer
\n
"
);
TRACE
(
"duplicating hardware buffer
\n
"
);
...
@@ -1194,6 +1199,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
...
@@ -1194,6 +1199,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
(
LPVOID
*
)
&
dsb
->
hwbuf
);
(
LPVOID
*
)
&
dsb
->
hwbuf
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
WARN
(
"IDsDriver_DuplicateSoundBuffer failed (%08x)
\n
"
,
hres
);
WARN
(
"IDsDriver_DuplicateSoundBuffer failed (%08x)
\n
"
,
hres
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
*
ppdsb
=
NULL
;
*
ppdsb
=
NULL
;
return
hres
;
return
hres
;
...
@@ -1213,15 +1219,6 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
...
@@ -1213,15 +1219,6 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
DSOUND_RecalcFormat
(
dsb
);
DSOUND_RecalcFormat
(
dsb
);
DSOUND_MixToTemporary
(
dsb
,
0
,
dsb
->
buflen
,
FALSE
);
DSOUND_MixToTemporary
(
dsb
,
0
,
dsb
->
buflen
,
FALSE
);
dsb
->
pwfx
=
DSOUND_CopyFormat
(
pdsb
->
pwfx
);
if
(
dsb
->
pwfx
==
NULL
)
{
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
tmp_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
*
ppdsb
=
NULL
;
return
DSERR_OUTOFMEMORY
;
}
RtlInitializeResource
(
&
dsb
->
lock
);
RtlInitializeResource
(
&
dsb
->
lock
);
/* register buffer */
/* register buffer */
...
@@ -1229,10 +1226,11 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
...
@@ -1229,10 +1226,11 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
if
(
hres
!=
DS_OK
)
{
if
(
hres
!=
DS_OK
)
{
RtlDeleteResource
(
&
dsb
->
lock
);
RtlDeleteResource
(
&
dsb
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
tmp_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
tmp_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
);
list_remove
(
&
dsb
->
entry
);
dsb
->
buffer
->
ref
--
;
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
*
ppdsb
=
0
;
dsb
=
NULL
;
}
}
*
ppdsb
=
dsb
;
*
ppdsb
=
dsb
;
...
...
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