Commit 840d47a8 authored by François Cartegnie's avatar François Cartegnie 🤞

Qt: MLModel: fix memleak

parent 40edf1ba
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment