[vlc-devel] commit: Fix potential memleak (CID 69) ( Rémi Duraffort )

git version control git at videolan.org
Sun Oct 5 19:45:08 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Oct  5 19:44:33 2008 +0200| [b9dc29f14cd4fb7898e8ee29de1707722523f63c] | committer: Rémi Duraffort 

Fix potential memleak (CID 69)

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

 modules/misc/xml/xtag.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules/misc/xml/xtag.c b/modules/misc/xml/xtag.c
index 6be8f44..602c4e5 100644
--- a/modules/misc/xml/xtag.c
+++ b/modules/misc/xml/xtag.c
@@ -644,7 +644,11 @@ static XTag *xtag_parse_tag( XTagParser *parser )
         while (parser->end - s > 2) {
             if (strncmp( s, "]]>", 3 ) == 0) {
                 if ( !(tag = malloc( sizeof(*tag))) ) return NULL;
-                if ( !(pcdata = malloc( sizeof(char)*(s - parser->start + 1))) ) return NULL;
+                if ( !(pcdata = malloc( sizeof(char)*(s - parser->start + 1))) )
+                {
+                    free( tag );
+                    return NULL;
+                }
                 strncpy( pcdata, parser->start, s - parser->start );
                 pcdata[s - parser->start]='\0';
                 parser->start = s = &s[3];




More information about the vlc-devel mailing list