[vlc-devel] [PATCH 2/3] qt: fix memory leaks when adding elements to the playlist
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Apr 12 15:19:41 CEST 2019
On Fri, Apr 12, 2019, at 2:23 PM, Pierre Lamot wrote:
> ---
> modules/gui/qt/components/mediacenter/mcmedialib.cpp | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/modules/gui/qt/components/mediacenter/mcmedialib.cpp
> b/modules/gui/qt/components/mediacenter/mcmedialib.cpp
> index 2fdf3159a0..7d08448bd2 100644
> --- a/modules/gui/qt/components/mediacenter/mcmedialib.cpp
> +++ b/modules/gui/qt/components/mediacenter/mcmedialib.cpp
> @@ -101,7 +101,10 @@ void MCMediaLib::addToPlaylist(const MLParentId &
> itemId)
> QVector<vlc::playlist::Media> medias;
> std::transform(mediaRange.begin(), mediaRange.end(),
> std::back_inserter(medias), [&](vlc_ml_media_t& m) {
> input_item_t* item = vlc_ml_get_input_item( m_ml, m.i_id );
> - return vlc::playlist::Media(item);
> + auto res = vlc::playlist::Media(item);
> + if ( item )
> + input_item_Release( item );
> + return res;
> });
> m_intf->p_sys->p_mainPlaylistController->append(medias, false);
> }
Fine by me but I'd prefer to wrap this in a unique_ptr
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list