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
7d6a605a
Commit
7d6a605a
authored
Jul 18, 2011
by
Jonathan Neuschäfer
Committed by
Max Kellermann
Jul 18, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/shout: fix a memory leak
parent
a6a8bdff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
shout_plugin.c
src/output/shout_plugin.c
+16
-12
No files found.
src/output/shout_plugin.c
View file @
7d6a605a
...
@@ -152,7 +152,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -152,7 +152,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
if
(
port
==
0
)
{
if
(
port
==
0
)
{
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"shout port must be configured"
);
"shout port must be configured"
);
return
NULL
;
goto
failure
;
}
}
check_block_param
(
"password"
);
check_block_param
(
"password"
);
...
@@ -174,21 +174,21 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -174,21 +174,21 @@ my_shout_init_driver(const struct audio_format *audio_format,
"shout quality
\"
%s
\"
is not a number in the "
"shout quality
\"
%s
\"
is not a number in the "
"range -1 to 10, line %i"
,
"range -1 to 10, line %i"
,
value
,
param
->
line
);
value
,
param
->
line
);
return
NULL
;
goto
failure
;
}
}
if
(
config_get_block_string
(
param
,
"bitrate"
,
NULL
)
!=
NULL
)
{
if
(
config_get_block_string
(
param
,
"bitrate"
,
NULL
)
!=
NULL
)
{
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"quality and bitrate are "
"quality and bitrate are "
"both defined"
);
"both defined"
);
return
NULL
;
goto
failure
;
}
}
}
else
{
}
else
{
value
=
config_get_block_string
(
param
,
"bitrate"
,
NULL
);
value
=
config_get_block_string
(
param
,
"bitrate"
,
NULL
);
if
(
value
==
NULL
)
{
if
(
value
==
NULL
)
{
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"neither bitrate nor quality defined"
);
"neither bitrate nor quality defined"
);
return
NULL
;
goto
failure
;
}
}
sd
->
bitrate
=
strtol
(
value
,
&
test
,
10
);
sd
->
bitrate
=
strtol
(
value
,
&
test
,
10
);
...
@@ -196,7 +196,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -196,7 +196,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
if
(
*
test
!=
'\0'
||
sd
->
bitrate
<=
0
)
{
if
(
*
test
!=
'\0'
||
sd
->
bitrate
<=
0
)
{
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"bitrate must be a positive integer"
);
"bitrate must be a positive integer"
);
return
NULL
;
goto
failure
;
}
}
}
}
...
@@ -206,12 +206,12 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -206,12 +206,12 @@ my_shout_init_driver(const struct audio_format *audio_format,
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"couldn't find shout encoder plugin
\"
%s
\"
"
,
"couldn't find shout encoder plugin
\"
%s
\"
"
,
encoding
);
encoding
);
return
NULL
;
goto
failure
;
}
}
sd
->
encoder
=
encoder_init
(
encoder_plugin
,
param
,
error
);
sd
->
encoder
=
encoder_init
(
encoder_plugin
,
param
,
error
);
if
(
sd
->
encoder
==
NULL
)
if
(
sd
->
encoder
==
NULL
)
return
NULL
;
goto
failure
;
if
(
strcmp
(
encoding
,
"mp3"
)
==
0
||
strcmp
(
encoding
,
"lame"
)
==
0
)
if
(
strcmp
(
encoding
,
"mp3"
)
==
0
||
strcmp
(
encoding
,
"lame"
)
==
0
)
shout_format
=
SHOUT_FORMAT_MP3
;
shout_format
=
SHOUT_FORMAT_MP3
;
...
@@ -225,7 +225,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -225,7 +225,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"you cannot stream
\"
%s
\"
to shoutcast, use mp3"
,
"you cannot stream
\"
%s
\"
to shoutcast, use mp3"
,
encoding
);
encoding
);
return
NULL
;
goto
failure
;
}
else
if
(
0
==
strcmp
(
value
,
"shoutcast"
))
}
else
if
(
0
==
strcmp
(
value
,
"shoutcast"
))
protocol
=
SHOUT_PROTOCOL_ICY
;
protocol
=
SHOUT_PROTOCOL_ICY
;
else
if
(
0
==
strcmp
(
value
,
"icecast1"
))
else
if
(
0
==
strcmp
(
value
,
"icecast1"
))
...
@@ -237,7 +237,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -237,7 +237,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
"shout protocol
\"
%s
\"
is not
\"
shoutcast
\"
or "
"shout protocol
\"
%s
\"
is not
\"
shoutcast
\"
or "
"
\"
icecast1
\"
or
\"
icecast2
\"
"
,
"
\"
icecast1
\"
or
\"
icecast2
\"
"
,
value
);
value
);
return
NULL
;
goto
failure
;
}
}
}
else
{
}
else
{
protocol
=
SHOUT_PROTOCOL_HTTP
;
protocol
=
SHOUT_PROTOCOL_HTTP
;
...
@@ -256,7 +256,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -256,7 +256,7 @@ my_shout_init_driver(const struct audio_format *audio_format,
shout_set_agent
(
sd
->
shout_conn
,
"MPD"
)
!=
SHOUTERR_SUCCESS
)
{
shout_set_agent
(
sd
->
shout_conn
,
"MPD"
)
!=
SHOUTERR_SUCCESS
)
{
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"%s"
,
shout_get_error
(
sd
->
shout_conn
));
"%s"
,
shout_get_error
(
sd
->
shout_conn
));
return
NULL
;
goto
failure
;
}
}
/* optional paramters */
/* optional paramters */
...
@@ -267,14 +267,14 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -267,14 +267,14 @@ my_shout_init_driver(const struct audio_format *audio_format,
if
(
value
!=
NULL
&&
shout_set_genre
(
sd
->
shout_conn
,
value
))
{
if
(
value
!=
NULL
&&
shout_set_genre
(
sd
->
shout_conn
,
value
))
{
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"%s"
,
shout_get_error
(
sd
->
shout_conn
));
"%s"
,
shout_get_error
(
sd
->
shout_conn
));
return
NULL
;
goto
failure
;
}
}
value
=
config_get_block_string
(
param
,
"description"
,
NULL
);
value
=
config_get_block_string
(
param
,
"description"
,
NULL
);
if
(
value
!=
NULL
&&
shout_set_description
(
sd
->
shout_conn
,
value
))
{
if
(
value
!=
NULL
&&
shout_set_description
(
sd
->
shout_conn
,
value
))
{
g_set_error
(
error
,
shout_output_quark
(),
0
,
g_set_error
(
error
,
shout_output_quark
(),
0
,
"%s"
,
shout_get_error
(
sd
->
shout_conn
));
"%s"
,
shout_get_error
(
sd
->
shout_conn
));
return
NULL
;
goto
failure
;
}
}
{
{
...
@@ -300,6 +300,10 @@ my_shout_init_driver(const struct audio_format *audio_format,
...
@@ -300,6 +300,10 @@ my_shout_init_driver(const struct audio_format *audio_format,
}
}
return
sd
;
return
sd
;
failure:
free_shout_data
(
sd
);
return
NULL
;
}
}
static
bool
static
bool
...
...
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