Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
7dd25734
Commit
7dd25734
authored
Aug 31, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video_filter_rss: factorize and fix object leaks and memleaks.
parent
e6bf1849
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
30 deletions
+38
-30
modules/video_filter/rss.c
modules/video_filter/rss.c
+38
-30
No files found.
modules/video_filter/rss.c
View file @
7dd25734
...
@@ -676,9 +676,10 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -676,9 +676,10 @@ static int FetchRSS( filter_t *p_filter)
{
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
stream_t
*
p_stream
=
NULL
;
stream_t
*
p_stream
;
xml_t
*
p_xml
=
NULL
;
xml_t
*
p_xml
;
xml_reader_t
*
p_xml_reader
=
NULL
;
xml_reader_t
*
p_xml_reader
;
int
i_ret
=
1
;
char
*
psz_eltname
=
NULL
;
char
*
psz_eltname
=
NULL
;
char
*
psz_eltvalue
=
NULL
;
char
*
psz_eltvalue
=
NULL
;
...
@@ -724,16 +725,15 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -724,16 +725,15 @@ static int FetchRSS( filter_t *p_filter)
if
(
!
p_stream
)
if
(
!
p_stream
)
{
{
msg_Err
(
p_filter
,
"Failed to open %s for reading"
,
p_feed
->
psz_url
);
msg_Err
(
p_filter
,
"Failed to open %s for reading"
,
p_feed
->
psz_url
);
xml_Delete
(
p_xml
)
;
p_xml_reader
=
NULL
;
return
1
;
goto
error
;
}
}
p_xml_reader
=
xml_ReaderCreate
(
p_xml
,
p_stream
);
p_xml_reader
=
xml_ReaderCreate
(
p_xml
,
p_stream
);
if
(
!
p_xml_reader
)
if
(
!
p_xml_reader
)
{
{
msg_Err
(
p_filter
,
"Failed to open %s for parsing"
,
p_feed
->
psz_url
);
msg_Err
(
p_filter
,
"Failed to open %s for parsing"
,
p_feed
->
psz_url
);
xml_Delete
(
p_xml
);
goto
error
;
return
1
;
}
}
i_item
=
0
;
i_item
=
0
;
...
@@ -746,15 +746,14 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -746,15 +746,14 @@ static int FetchRSS( filter_t *p_filter)
{
{
// Error
// Error
case
-
1
:
case
-
1
:
return
1
;
goto
error
;
case
XML_READER_STARTELEM
:
case
XML_READER_STARTELEM
:
free
(
psz_eltname
);
free
(
psz_eltname
);
psz_eltname
=
xml_ReaderName
(
p_xml_reader
);
psz_eltname
=
xml_ReaderName
(
p_xml_reader
);
if
(
!
psz_eltname
)
if
(
!
psz_eltname
)
{
goto
error
;
return
1
;
}
# ifdef RSS_DEBUG
# ifdef RSS_DEBUG
msg_Dbg
(
p_filter
,
"element name: %s"
,
psz_eltname
);
msg_Dbg
(
p_filter
,
"element name: %s"
,
psz_eltname
);
# endif
# endif
...
@@ -839,12 +838,10 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -839,12 +838,10 @@ static int FetchRSS( filter_t *p_filter)
case
XML_READER_ENDELEM
:
case
XML_READER_ENDELEM
:
free
(
psz_eltname
);
free
(
psz_eltname
);
psz_eltname
=
NULL
;
psz_eltname
=
xml_ReaderName
(
p_xml_reader
);
psz_eltname
=
xml_ReaderName
(
p_xml_reader
);
if
(
!
psz_eltname
)
if
(
!
psz_eltname
)
{
goto
error
;
return
1
;
}
# ifdef RSS_DEBUG
# ifdef RSS_DEBUG
msg_Dbg
(
p_filter
,
"element end : %s"
,
psz_eltname
);
msg_Dbg
(
p_filter
,
"element end : %s"
,
psz_eltname
);
# endif
# endif
...
@@ -858,8 +855,7 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -858,8 +855,7 @@ static int FetchRSS( filter_t *p_filter)
{
{
b_is_image
=
false
;
b_is_image
=
false
;
}
}
free
(
psz_eltname
);
FREENULL
(
psz_eltname
);
psz_eltname
=
NULL
;
break
;
break
;
case
XML_READER_TEXT
:
case
XML_READER_TEXT
:
...
@@ -867,13 +863,13 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -867,13 +863,13 @@ static int FetchRSS( filter_t *p_filter)
psz_eltvalue
=
xml_ReaderValue
(
p_xml_reader
);
psz_eltvalue
=
xml_ReaderValue
(
p_xml_reader
);
if
(
!
psz_eltvalue
)
if
(
!
psz_eltvalue
)
{
{
return
1
;
goto
error
;
}
}
else
else
{
{
char
*
psz_clean
;
char
*
psz_clean
=
removeWhiteChars
(
psz_eltvalue
)
;
psz_clean
=
removeWhiteChars
(
psz_eltvalue
);
free
(
psz_eltvalue
);
free
(
psz_eltvalue
);
psz_eltvalue
=
psz_clean
;
psz_eltvalue
=
psz_clean
;
}
}
# ifdef RSS_DEBUG
# ifdef RSS_DEBUG
msg_Dbg
(
p_filter
,
" text : <%s>"
,
psz_eltvalue
);
msg_Dbg
(
p_filter
,
" text : <%s>"
,
psz_eltvalue
);
...
@@ -899,8 +895,7 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -899,8 +895,7 @@ static int FetchRSS( filter_t *p_filter)
}
}
else
else
{
{
free
(
psz_eltvalue
);
FREENULL
(
psz_eltvalue
);
psz_eltvalue
=
NULL
;
}
}
}
}
else
if
(
b_is_image
==
true
)
else
if
(
b_is_image
==
true
)
...
@@ -912,8 +907,7 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -912,8 +907,7 @@ static int FetchRSS( filter_t *p_filter)
}
}
else
else
{
{
free
(
psz_eltvalue
);
FREENULL
(
psz_eltvalue
);
psz_eltvalue
=
NULL
;
}
}
}
}
else
else
...
@@ -942,8 +936,7 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -942,8 +936,7 @@ static int FetchRSS( filter_t *p_filter)
}
}
else
else
{
{
free
(
psz_eltvalue
);
FREENULL
(
psz_eltvalue
);
psz_eltvalue
=
NULL
;
}
}
}
}
break
;
break
;
...
@@ -956,13 +949,28 @@ static int FetchRSS( filter_t *p_filter)
...
@@ -956,13 +949,28 @@ static int FetchRSS( filter_t *p_filter)
p_feed
->
p_pic
=
LoadImage
(
p_filter
,
p_feed
->
psz_image
);
p_feed
->
p_pic
=
LoadImage
(
p_filter
,
p_feed
->
psz_image
);
}
}
if
(
p_xml_reader
&&
p_xml
)
xml_ReaderDelete
(
p_xml
,
p_xml_reader
);
xml_ReaderDelete
(
p_xml
,
p_xml_reader
);
if
(
p_stream
)
stream_Delete
(
p_stream
);
stream_Delete
(
p_stream
);
msg_Dbg
(
p_filter
,
"done with %s RSS/Atom feed"
,
p_feed
->
psz_url
);
msg_Dbg
(
p_filter
,
"done with %s RSS/Atom feed"
,
p_feed
->
psz_url
);
}
}
if
(
p_xml
)
xml_Delete
(
p_xml
);
free
(
psz_eltname
);
free
(
psz_eltvalue
);
xml_Delete
(
p_xml
);
return
0
;
return
0
;
error:
free
(
psz_eltname
);
free
(
psz_eltvalue
);
if
(
p_xml_reader
)
xml_ReaderDelete
(
p_xml
,
p_xml_reader
);
if
(
p_stream
)
stream_Delete
(
p_stream
);
if
(
p_xml
)
xml_Delete
(
p_xml
);
return
i_ret
;
}
}
/****************************************************************************
/****************************************************************************
...
...
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