[vlc-commits] qt: Fix memory leak

Hugo Beauzée-Luyssen git at videolan.org
Tue Feb 14 15:30:40 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Feb 14 15:02:25 2017 +0100| [7496c5d3d1e1d2e958deb7989a8315e7c5795ba8] | committer: Hugo Beauzée-Luyssen

qt: Fix memory leak

CID #1402725

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

 modules/gui/qt/components/simple_preferences.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp
index f216653..e9c0133 100644
--- a/modules/gui/qt/components/simple_preferences.cpp
+++ b/modules/gui/qt/components/simple_preferences.cpp
@@ -1230,7 +1230,10 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
     const char* psz_VLC = "VLC";
     current = new QTreeWidgetItem( parent, QStringList( psz_ext ) );
 
-    if( strstr( qvReg->ReadRegistry( psz_ext, "", "" ), psz_VLC ) )
+    char* psz_reg = qvReg->ReadRegistry( psz_ext, "", "" );
+    if( psz_reg == NULL )
+        return false;
+    if( strstr( psz_reg, psz_VLC ) )
     {
         current->setCheckState( 0, Qt::Checked );
         b_temp = true;
@@ -1240,6 +1243,7 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
         current->setCheckState( 0, Qt::Unchecked );
         b_temp = false;
     }
+    free( psz_reg );
     listAsso.append( current );
     return b_temp;
 }



More information about the vlc-commits mailing list