[vlc-commits] Qt: MLModel: fix memleak
Francois Cartegnie
git at videolan.org
Thu Sep 6 12:40:19 CEST 2012
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep 6 12:39:39 2012 +0200| [840d47a8c82537c42c21c5b5c0a61c0a1d15aac2] | committer: Francois Cartegnie
Qt: MLModel: fix memleak
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=840d47a8c82537c42c21c5b5c0a61c0a1d15aac2
---
modules/gui/qt4/components/playlist/ml_model.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/ml_model.cpp b/modules/gui/qt4/components/playlist/ml_model.cpp
index 32ba453..e98be71 100644
--- a/modules/gui/qt4/components/playlist/ml_model.cpp
+++ b/modules/gui/qt4/components/playlist/ml_model.cpp
@@ -65,8 +65,13 @@ MLModel::MLModel( intf_thread_t* _p_intf, QObject *parent )
if ( !p_ml ) return;
vlc_array_t *p_result_array = vlc_array_new();
- ml_Find( p_ml, p_result_array, ML_MEDIA );
- insertResultArray( p_result_array );
+ if ( p_result_array )
+ {
+ ml_Find( p_ml, p_result_array, ML_MEDIA );
+ insertResultArray( p_result_array );
+ ml_DestroyResultArray( p_result_array );
+ vlc_array_destroy( p_result_array );
+ }
var_AddCallback( p_ml, "media-added", mediaAdded, this );
var_AddCallback( p_ml, "media-deleted", mediaDeleted, this );
@@ -593,6 +598,7 @@ static int mediaAdded( vlc_object_t *p_this, char const *psz_var,
return VLC_EGENERIC;
}
p_model->insertResultArray( p_result );
+ ml_DestroyResultArray( p_result );
vlc_array_destroy( p_result );
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list