[vlc-commits] MediaPlayer: Don't wrap potentially uninitialized pointers
Hugo Beauzée-Luyssen
git at videolan.org
Fri Aug 21 17:31:28 CEST 2015
libvlcpp | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Aug 21 17:30:36 2015 +0200| [bc9b0be758975b02506b7d29a9c3fe37a757c641] | committer: Hugo Beauzée-Luyssen
MediaPlayer: Don't wrap potentially uninitialized pointers
> http://git.videolan.org/gitweb.cgi/libvlcpp.git/?a=commit;h=bc9b0be758975b02506b7d29a9c3fe37a757c641
---
vlcpp/MediaPlayer.hpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/vlcpp/MediaPlayer.hpp b/vlcpp/MediaPlayer.hpp
index ad99285..ca6a2ff 100644
--- a/vlcpp/MediaPlayer.hpp
+++ b/vlcpp/MediaPlayer.hpp
@@ -1352,13 +1352,13 @@ public:
libvlc_title_descriptions_release( ts, nbTitles );
};
- std::unique_ptr<libvlc_title_description_t*[], decltype(cleanupCb)> ptr(
- titles, cleanupCb);
std::vector<TitleDescription> res;
if ( nbTitles < 1 )
return res;
+ std::unique_ptr<libvlc_title_description_t*[], decltype(cleanupCb)> ptr( titles, cleanupCb );
+
for ( int i = 0; i < nbTitles; ++i )
res.emplace_back( ptr[i] );
return res;
@@ -1387,13 +1387,14 @@ public:
auto cleanupCb = [nbChapters](libvlc_chapter_description_t** cs) {
libvlc_chapter_descriptions_release( cs, nbChapters );
};
- std::unique_ptr<libvlc_chapter_description_t*[], decltype(cleanupCb)> ptr( chapters, cleanupCb );
std::vector<ChapterDescription> res;
if ( nbChapters < 1 )
return res;
+ std::unique_ptr<libvlc_chapter_description_t*[], decltype(cleanupCb)> ptr( chapters, cleanupCb );
+
for ( int i = 0; i < nbChapters; ++i )
res.emplace_back( ptr[i] );
return res;
More information about the vlc-commits
mailing list