[vlc-devel] commit: Leak rather than crash ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Mar 17 19:04:35 CET 2009


vlc | branch: 0.9-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar 15 19:24:29 2009 +0200| [4d3f528537181eb5f53fcaf09fbac75987d93373] | committer: Rémi Denis-Courmont 

Leak rather than crash

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

 modules/misc/xml/libxml.c |   37 +------------------------------------
 1 files changed, 1 insertions(+), 36 deletions(-)

diff --git a/modules/misc/xml/libxml.c b/modules/misc/xml/libxml.c
index 2afe3a5..6712dcb 100644
--- a/modules/misc/xml/libxml.c
+++ b/modules/misc/xml/libxml.c
@@ -67,33 +67,6 @@ static void CatalogLoad( xml_t *, const char * );
 static void CatalogAdd( xml_t *, const char *, const char *, const char * );
 static int StreamRead( void *p_context, char *p_buffer, int i_buffer );
 
-static unsigned refs = 0;
-#if defined (LIBVLC_USE_PTHREAD)
-static vlc_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-#elif defined (WIN32)
-static vlc_mutex_t lock;
-
-BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
-{
-    (void) hinstDll;
-    (void) lpvReserved;
-
-    switch (fdwReason)
-    {
-        case DLL_PROCESS_ATTACH:
-            vlc_mutex_init (&lock);
-            break;
-
-        case DLL_PROCESS_DETACH:
-            vlc_mutex_destroy (&lock);
-            break;
-    }
-    return TRUE;
-}
-#else
-# error FIXME
-#endif
-
 /*****************************************************************************
  * Module initialization
  *****************************************************************************/
@@ -104,10 +77,7 @@ static int Open( vlc_object_t *p_this )
     if( !xmlHasFeature( XML_WITH_THREAD ) )
         return VLC_EGENERIC;
 
-    vlc_mutex_lock( &lock );
-    if( refs++ == 0 )
-        xmlInitParser();
-    vlc_mutex_unlock( &lock );
+    xmlInitParser();
 
     p_xml->pf_reader_create = ReaderCreate;
     p_xml->pf_reader_delete = ReaderDelete;
@@ -123,11 +93,6 @@ static int Open( vlc_object_t *p_this )
  *****************************************************************************/
 static void Close( vlc_object_t *p_this )
 {
-    vlc_mutex_lock( &lock );
-    if( --refs == 0 )
-        xmlCleanupParser();
-    vlc_mutex_unlock( &lock );
-
     VLC_UNUSED(p_this);
     return;
 }




More information about the vlc-devel mailing list