Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
ced209fa
Commit
ced209fa
authored
Apr 24, 2006
by
Christophe Mutricy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shoutcast.c: Memleak hunt.
parent
ec4b9fba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
19 deletions
+37
-19
modules/demux/playlist/shoutcast.c
modules/demux/playlist/shoutcast.c
+37
-19
No files found.
modules/demux/playlist/shoutcast.c
View file @
ced209fa
...
@@ -176,12 +176,20 @@ static int Demux( demux_t *p_demux )
...
@@ -176,12 +176,20 @@ static int Demux( demux_t *p_demux )
if
(
!
strcmp
(
psz_eltname
,
"genrelist"
)
)
if
(
!
strcmp
(
psz_eltname
,
"genrelist"
)
)
{
{
/* we're reading a genre list */
/* we're reading a genre list */
if
(
DemuxGenre
(
p_demux
)
)
return
-
1
;
if
(
DemuxGenre
(
p_demux
)
)
{
free
(
psz_eltname
);
return
-
1
;
}
}
}
else
else
{
{
/* we're reading a station list */
/* we're reading a station list */
if
(
DemuxStation
(
p_demux
)
)
return
-
1
;
if
(
DemuxStation
(
p_demux
)
)
{
free
(
psz_eltname
);
return
-
1
;
}
}
}
free
(
psz_eltname
);
free
(
psz_eltname
);
...
@@ -216,6 +224,7 @@ static int DemuxGenre( demux_t *p_demux )
...
@@ -216,6 +224,7 @@ static int DemuxGenre( demux_t *p_demux )
char
*
psz_name
=
NULL
;
/* genre name */
char
*
psz_name
=
NULL
;
/* genre name */
char
*
psz_eltname
=
NULL
;
/* tag name */
char
*
psz_eltname
=
NULL
;
/* tag name */
#define FREE(a) if( a ) free( a ); a = NULL;
while
(
xml_ReaderRead
(
p_sys
->
p_xml_reader
)
==
1
)
while
(
xml_ReaderRead
(
p_sys
->
p_xml_reader
)
==
1
)
{
{
int
i_type
;
int
i_type
;
...
@@ -231,7 +240,6 @@ static int DemuxGenre( demux_t *p_demux )
...
@@ -231,7 +240,6 @@ static int DemuxGenre( demux_t *p_demux )
case
XML_READER_STARTELEM
:
case
XML_READER_STARTELEM
:
// Read the element name
// Read the element name
if
(
psz_eltname
)
free
(
psz_eltname
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
if
(
!
psz_eltname
)
return
-
1
;
if
(
!
psz_eltname
)
return
-
1
;
...
@@ -244,7 +252,14 @@ static int DemuxGenre( demux_t *p_demux )
...
@@ -244,7 +252,14 @@ static int DemuxGenre( demux_t *p_demux )
char
*
psz_attrname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
char
*
psz_attrname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
char
*
psz_attrvalue
=
char
*
psz_attrvalue
=
xml_ReaderValue
(
p_sys
->
p_xml_reader
);
xml_ReaderValue
(
p_sys
->
p_xml_reader
);
if
(
!
psz_attrname
||
!
psz_attrvalue
)
return
-
1
;
if
(
!
psz_attrname
||
!
psz_attrvalue
)
{
FREE
(
psz_attrname
);
FREE
(
psz_attrvalue
);
free
(
psz_eltname
);
/*FIXME: isn't return a bit too much. what about break*/
return
-
1
;
}
GET_VALUE
(
name
)
GET_VALUE
(
name
)
else
else
...
@@ -258,6 +273,7 @@ static int DemuxGenre( demux_t *p_demux )
...
@@ -258,6 +273,7 @@ static int DemuxGenre( demux_t *p_demux )
free
(
psz_attrvalue
);
free
(
psz_attrvalue
);
}
}
}
}
free
(
psz_eltname
);
psz_eltname
=
NULL
;
break
;
break
;
case
XML_READER_TEXT
:
case
XML_READER_TEXT
:
...
@@ -266,7 +282,6 @@ static int DemuxGenre( demux_t *p_demux )
...
@@ -266,7 +282,6 @@ static int DemuxGenre( demux_t *p_demux )
// End element
// End element
case
XML_READER_ENDELEM
:
case
XML_READER_ENDELEM
:
// Read the element name
// Read the element name
free
(
psz_eltname
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
if
(
!
psz_eltname
)
return
-
1
;
if
(
!
psz_eltname
)
return
-
1
;
if
(
!
strcmp
(
psz_eltname
,
"genre"
)
)
if
(
!
strcmp
(
psz_eltname
,
"genre"
)
)
...
@@ -291,13 +306,9 @@ static int DemuxGenre( demux_t *p_demux )
...
@@ -291,13 +306,9 @@ static int DemuxGenre( demux_t *p_demux )
vlc_input_item_CopyOptions
(
&
p_sys
->
p_current
->
input
,
vlc_input_item_CopyOptions
(
&
p_sys
->
p_current
->
input
,
&
p_item
->
input
);
&
p_item
->
input
);
#define FREE(a) if( a ) free( a ); a = NULL;
FREE
(
psz_name
);
FREE
(
psz_name
);
#undef FREE
}
}
free
(
psz_eltname
);
free
(
psz_eltname
);
psz_eltname
=
NULL
;
psz_eltname
=
strdup
(
""
);
break
;
break
;
}
}
}
}
...
@@ -364,7 +375,6 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -364,7 +375,6 @@ static int DemuxStation( demux_t *p_demux )
case
XML_READER_STARTELEM
:
case
XML_READER_STARTELEM
:
// Read the element name
// Read the element name
if
(
psz_eltname
)
free
(
psz_eltname
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
if
(
!
psz_eltname
)
return
-
1
;
if
(
!
psz_eltname
)
return
-
1
;
...
@@ -376,7 +386,13 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -376,7 +386,13 @@ static int DemuxStation( demux_t *p_demux )
char
*
psz_attrname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
char
*
psz_attrname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
char
*
psz_attrvalue
=
char
*
psz_attrvalue
=
xml_ReaderValue
(
p_sys
->
p_xml_reader
);
xml_ReaderValue
(
p_sys
->
p_xml_reader
);
if
(
!
psz_attrname
||
!
psz_attrvalue
)
return
-
1
;
if
(
!
psz_attrname
||
!
psz_attrvalue
)
{
free
(
psz_eltname
);
FREE
(
psz_attrname
);
FREE
(
psz_attrvalue
);
return
-
1
;
}
GET_VALUE
(
base
)
GET_VALUE
(
base
)
else
else
...
@@ -397,7 +413,13 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -397,7 +413,13 @@ static int DemuxStation( demux_t *p_demux )
char
*
psz_attrname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
char
*
psz_attrname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
char
*
psz_attrvalue
=
char
*
psz_attrvalue
=
xml_ReaderValue
(
p_sys
->
p_xml_reader
);
xml_ReaderValue
(
p_sys
->
p_xml_reader
);
if
(
!
psz_attrname
||
!
psz_attrvalue
)
return
-
1
;
if
(
!
psz_attrname
||
!
psz_attrvalue
)
{
free
(
psz_eltname
);
FREE
(
psz_attrname
);
FREE
(
psz_attrvalue
);
return
-
1
;
}
GET_VALUE
(
name
)
GET_VALUE
(
name
)
else
GET_VALUE
(
mt
)
else
GET_VALUE
(
mt
)
...
@@ -419,6 +441,7 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -419,6 +441,7 @@ static int DemuxStation( demux_t *p_demux )
free
(
psz_attrvalue
);
free
(
psz_attrvalue
);
}
}
}
}
free
(
psz_eltname
);
break
;
break
;
case
XML_READER_TEXT
:
case
XML_READER_TEXT
:
...
@@ -427,7 +450,6 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -427,7 +450,6 @@ static int DemuxStation( demux_t *p_demux )
// End element
// End element
case
XML_READER_ENDELEM
:
case
XML_READER_ENDELEM
:
// Read the element name
// Read the element name
free
(
psz_eltname
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
psz_eltname
=
xml_ReaderName
(
p_sys
->
p_xml_reader
);
if
(
!
psz_eltname
)
return
-
1
;
if
(
!
psz_eltname
)
return
-
1
;
if
(
!
strcmp
(
psz_eltname
,
"station"
)
&&
if
(
!
strcmp
(
psz_eltname
,
"station"
)
&&
...
@@ -452,7 +474,6 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -452,7 +474,6 @@ static int DemuxStation( demux_t *p_demux )
sprintf
(
psz_mrl
,
SHOUTCAST_TUNEIN_BASE_URL
"%s?id=%s"
,
sprintf
(
psz_mrl
,
SHOUTCAST_TUNEIN_BASE_URL
"%s?id=%s"
,
psz_base
,
psz_id
);
psz_base
,
psz_id
);
}
}
msg_Warn
(
p_demux
,
"%s"
,
psz_mrl
);
p_item
=
playlist_ItemNew
(
p_sys
->
p_playlist
,
psz_mrl
,
p_item
=
playlist_ItemNew
(
p_sys
->
p_playlist
,
psz_mrl
,
psz_name
);
psz_name
);
free
(
psz_mrl
);
free
(
psz_mrl
);
...
@@ -526,7 +547,6 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -526,7 +547,6 @@ static int DemuxStation( demux_t *p_demux )
vlc_input_item_CopyOptions
(
&
p_sys
->
p_current
->
input
,
vlc_input_item_CopyOptions
(
&
p_sys
->
p_current
->
input
,
&
p_item
->
input
);
&
p_item
->
input
);
#define FREE(a) if( a ) free( a ); a = NULL;
FREE
(
psz_name
);
FREE
(
psz_name
);
FREE
(
psz_mt
)
FREE
(
psz_mt
)
FREE
(
psz_id
)
FREE
(
psz_id
)
...
@@ -535,16 +555,14 @@ static int DemuxStation( demux_t *p_demux )
...
@@ -535,16 +555,14 @@ static int DemuxStation( demux_t *p_demux )
FREE
(
psz_ct
)
FREE
(
psz_ct
)
FREE
(
psz_lc
)
FREE
(
psz_lc
)
FREE
(
psz_rt
)
FREE
(
psz_rt
)
#undef FREE
}
}
free
(
psz_eltname
);
free
(
psz_eltname
);
psz_eltname
=
strdup
(
""
);
break
;
break
;
}
}
}
}
return
0
;
return
0
;
}
}
#undef FREE
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
{
...
...
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