]> git.sesse.net Git - vlc/commitdiff
* skins2/vars/equalizer.cpp: Fixed an invalid memory read, potential crasher
authorOlivier Teulière <ipkiss@videolan.org>
Mon, 11 Dec 2006 22:19:56 +0000 (22:19 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Mon, 11 Dec 2006 22:19:56 +0000 (22:19 +0000)
 * skins2/src/generic_layout.cpp: Fixed an old memory leak
This is a forwardport of [18282]

modules/gui/skins2/src/generic_layout.cpp
modules/gui/skins2/vars/equalizer.cpp

index 8d12ff1d60392529b666e8a07c3f76facdcde83e..c3bd603825f3512245467af7810553b82987326b 100644 (file)
@@ -27,6 +27,7 @@
 #include "os_factory.hpp"
 #include "os_graphics.hpp"
 #include "var_manager.hpp"
+#include "anchor.hpp"
 #include "../controls/ctrl_generic.hpp"
 #include "../controls/ctrl_video.hpp"
 #include "../utils/var_bool.hpp"
@@ -57,6 +58,11 @@ GenericLayout::~GenericLayout()
     {
         delete m_pImage;
     }
+    list<Anchor*>::const_iterator it;
+    for( it = m_anchorList.begin(); it != m_anchorList.end(); it++ )
+    {
+        delete *it;
+    }
 }
 
 
index 4ae3dad705c3b44491274425f81c14ebc55f72d6..d6bd705483154c51a0058edd8b3b586b93882f2f 100644 (file)
@@ -94,14 +94,15 @@ void EqualizerBands::onUpdate( Subject<VarPercent> &rBand, void *arg )
             ss << " " << val;
         }
 
+
+        string bands = ss.str();
         aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
                 VLC_OBJECT_AOUT, FIND_ANYWHERE );
-        char *bands = (char*)ss.str().c_str();
-        config_PutPsz( getIntf(), "equalizer-bands", bands );
+        config_PutPsz( getIntf(), "equalizer-bands", bands.c_str() );
         if( pAout )
         {
             // Update the audio output
-            var_SetString( pAout, "equalizer-bands", bands );
+            var_SetString( pAout, "equalizer-bands", (char*)bands.c_str() );
             vlc_object_release( pAout );
         }
     }