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
45598d76
Commit
45598d76
authored
Aug 22, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Factor wm reader sample allocator error checks.
parent
42e98094
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
28 deletions
+16
-28
wm_reader.c
dlls/winegstreamer/wm_reader.c
+16
-28
No files found.
dlls/winegstreamer/wm_reader.c
View file @
45598d76
...
...
@@ -1573,9 +1573,10 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA
struct
wg_parser_stream
*
wg_stream
;
struct
wg_parser_buffer
wg_buffer
;
struct
wm_stream
*
stream
;
struct
buffer
*
object
;
DWORD
size
,
capacity
;
INSSBuffer
*
sample
;
HRESULT
hr
;
HRESULT
hr
=
S_OK
;
BYTE
*
data
;
for
(;;)
...
...
@@ -1620,36 +1621,16 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA
TRACE
(
"Got buffer for '%s' stream %p.
\n
"
,
get_major_type_string
(
stream
->
format
.
major_type
),
stream
);
if
(
callback_advanced
&&
stream
->
read_compressed
&&
stream
->
allocate_stream
)
{
if
(
FAILED
(
hr
=
IWMReaderCallbackAdvanced_AllocateForStream
(
callback_advanced
,
stream
->
index
+
1
,
wg_buffer
.
size
,
&
sample
,
NULL
)))
{
ERR
(
"Failed to allocate stream sample of %u bytes, hr %#lx.
\n
"
,
wg_buffer
.
size
,
hr
);
wg_parser_stream_release_buffer
(
wg_stream
);
return
hr
;
}
}
hr
=
IWMReaderCallbackAdvanced_AllocateForStream
(
callback_advanced
,
stream
->
index
+
1
,
wg_buffer
.
size
,
&
sample
,
NULL
);
else
if
(
callback_advanced
&&
!
stream
->
read_compressed
&&
stream
->
allocate_output
)
{
if
(
FAILED
(
hr
=
IWMReaderCallbackAdvanced_AllocateForOutput
(
callback_advanced
,
stream
->
index
,
wg_buffer
.
size
,
&
sample
,
NULL
)))
{
ERR
(
"Failed to allocate output sample of %u bytes, hr %#lx.
\n
"
,
wg_buffer
.
size
,
hr
);
wg_parser_stream_release_buffer
(
wg_stream
);
return
hr
;
}
}
hr
=
IWMReaderCallbackAdvanced_AllocateForOutput
(
callback_advanced
,
stream
->
index
,
wg_buffer
.
size
,
&
sample
,
NULL
);
/* FIXME: Should these be pooled? */
else
if
(
!
(
object
=
calloc
(
1
,
offsetof
(
struct
buffer
,
data
[
wg_buffer
.
size
]))))
hr
=
E_OUTOFMEMORY
;
else
{
struct
buffer
*
object
;
/* FIXME: Should these be pooled? */
if
(
!
(
object
=
calloc
(
1
,
offsetof
(
struct
buffer
,
data
[
wg_buffer
.
size
]))))
{
wg_parser_stream_release_buffer
(
wg_stream
);
return
E_OUTOFMEMORY
;
}
object
->
INSSBuffer_iface
.
lpVtbl
=
&
buffer_vtbl
;
object
->
refcount
=
1
;
object
->
capacity
=
wg_buffer
.
size
;
...
...
@@ -1658,6 +1639,13 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA
sample
=
&
object
->
INSSBuffer_iface
;
}
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to allocate sample of %u bytes, hr %#lx.
\n
"
,
wg_buffer
.
size
,
hr
);
wg_parser_stream_release_buffer
(
wg_stream
);
return
hr
;
}
if
(
FAILED
(
hr
=
INSSBuffer_GetBufferAndLength
(
sample
,
&
data
,
&
size
)))
ERR
(
"Failed to get data pointer, hr %#lx.
\n
"
,
hr
);
if
(
FAILED
(
hr
=
INSSBuffer_GetMaxLength
(
sample
,
&
capacity
)))
...
...
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