[vlc-commits] demux: xspf: fix leaks with unwanted attributes (cid #1253106)

Francois Cartegnie git at videolan.org
Fri Jan 1 18:17:55 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jan  1 17:58:23 2016 +0100| [8348ef445cc9da9d682ae0632b4b1f8f98a2bd8d] | committer: Francois Cartegnie

demux: xspf: fix leaks with unwanted attributes (cid #1253106)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8348ef445cc9da9d682ae0632b4b1f8f98a2bd8d
---

 modules/demux/playlist/xspf.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index c2a771a..30bf186 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -626,6 +626,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
     {
         if (!psz_title)
         {
+            free(psz_application);
             msg_Warn(p_demux, "<vlc:node> requires \"title\" attribute");
             return false;
         }
@@ -639,12 +640,12 @@ static bool parse_extension_node COMPLEX_INTERFACE
             p_input_item = p_new_input;
             b_release_input_item = true;
         }
-        free(psz_title);
     }
     else if (!strcmp(psz_element, "extension"))
     {
         if (!psz_application)
         {
+            free(psz_title);
             msg_Warn(p_demux, "<extension> requires \"application\" attribute");
             return false;
         }
@@ -654,6 +655,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
         {
             msg_Dbg(p_demux, "Skipping \"%s\" extension tag", psz_application);
             free(psz_application);
+            free(psz_title);
             /* Skip all children */
             for (unsigned lvl = 1; lvl;)
                 switch (xml_ReaderNextNode(p_xml_reader, NULL))
@@ -666,7 +668,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
         }
     }
     free(psz_application);
-
+    free(psz_title);
 
     /* parse the child elements */
     while ((i_node = xml_ReaderNextNode(p_xml_reader, &name)) > 0)



More information about the vlc-commits mailing list