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

git version control git at videolan.org
Fri Aug 15 21:54:40 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Aug 15 09:14:27 2008 +0200| [912035aaf7f6405f99b10a371540653b2d42cb0c] | committer: Rémi Duraffort 

Fix potential memleak.

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

 modules/misc/freetype.c   |    4 ++--
 modules/misc/quartztext.c |    5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index ec6dadf..57dbc9d 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -1862,9 +1862,9 @@ static int HandleFontAttributes( xml_reader_t *p_xml_reader,
                 i_font_alpha = strtol( psz_value + 1, NULL, 16 );
                 i_font_alpha &= 0xff;
             }
-            free( psz_name );
-            free( psz_value );
         }
+        free( psz_name );
+        free( psz_value );
     }
     rv = PushFont( p_fonts,
                    psz_fontname,
diff --git a/modules/misc/quartztext.c b/modules/misc/quartztext.c
index 27517e4..f6bb1f5 100644
--- a/modules/misc/quartztext.c
+++ b/modules/misc/quartztext.c
@@ -663,9 +663,9 @@ static int HandleFontAttributes( xml_reader_t *p_xml_reader,
                 i_font_alpha = strtol( psz_value + 1, NULL, 16 );
                 i_font_alpha &= 0xff;
             }
-            free( psz_name );
-            free( psz_value );
         }
+        free( psz_name );
+        free( psz_value );
     }
     rv = PushFont( p_fonts,
                    psz_fontname,
@@ -736,7 +736,6 @@ static int ProcessNodes( filter_t *p_filter,
                 break;
             case XML_READER_ENDELEM:
                 psz_node = xml_ReaderName( p_xml_reader );
-
                 if( psz_node )
                 {
                     if( !strcasecmp( "font", psz_node ) )




More information about the vlc-devel mailing list