Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
e2bc6321
Commit
e2bc6321
authored
Dec 31, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Thread: decoder_input_stream_open() returns std::unique_ptr<InputStream>
Fixes memory leak after InputStream::Check() failure.
parent
6c5b8bcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+10
-6
No files found.
src/decoder/DecoderThread.cxx
View file @
e2bc6321
...
...
@@ -55,12 +55,13 @@ static constexpr Domain decoder_thread_domain("decoder_thread");
* @return an InputStream on success or if #DecoderCommand::STOP is
* received, nullptr on error
*/
static
InputStream
*
static
std
::
unique_ptr
<
InputStream
>
decoder_input_stream_open
(
DecoderControl
&
dc
,
const
char
*
uri
)
{
Error
error
;
InputStream
*
is
=
InputStream
::
Open
(
uri
,
dc
.
mutex
,
dc
.
cond
,
error
);
std
::
unique_ptr
<
InputStream
>
is
(
InputStream
::
Open
(
uri
,
dc
.
mutex
,
dc
.
cond
,
error
));
if
(
is
==
nullptr
)
{
if
(
error
.
IsDefined
())
LogError
(
error
);
...
...
@@ -89,12 +90,13 @@ decoder_input_stream_open(DecoderControl &dc, const char *uri)
return
is
;
}
static
InputStream
*
static
std
::
unique_ptr
<
InputStream
>
decoder_input_stream_open
(
DecoderControl
&
dc
,
Path
path
)
{
Error
error
;
InputStream
*
is
=
OpenLocalInputStream
(
path
,
dc
.
mutex
,
dc
.
cond
,
error
);
std
::
unique_ptr
<
InputStream
>
is
(
OpenLocalInputStream
(
path
,
dc
.
mutex
,
dc
.
cond
,
error
));
if
(
is
==
nullptr
)
{
LogError
(
error
);
return
nullptr
;
...
...
@@ -261,7 +263,8 @@ decoder_run_stream(Decoder &decoder, const char *uri)
{
DecoderControl
&
dc
=
decoder
.
dc
;
std
::
unique_ptr
<
InputStream
>
input_stream
(
decoder_input_stream_open
(
dc
,
uri
));
std
::
unique_ptr
<
InputStream
>
input_stream
=
decoder_input_stream_open
(
dc
,
uri
);
if
(
input_stream
==
nullptr
)
return
false
;
...
...
@@ -307,7 +310,8 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
const
ScopeLock
protect
(
dc
.
mutex
);
return
decoder_file_decode
(
plugin
,
decoder
,
path_fs
);
}
else
if
(
plugin
.
stream_decode
!=
nullptr
)
{
std
::
unique_ptr
<
InputStream
>
input_stream
(
decoder_input_stream_open
(
dc
,
path_fs
));
std
::
unique_ptr
<
InputStream
>
input_stream
=
decoder_input_stream_open
(
dc
,
path_fs
);
if
(
input_stream
==
nullptr
)
return
false
;
...
...
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