[vlmc-devel] [PATCH] MLTBackend: Error checking on m_mltRepo init

Paweł Goliński golpaw1 at gmail.com
Thu Jul 21 13:08:38 CEST 2016


> Wiadomość napisana przez yikei lu <luyikei.qmltu at gmail.com> w dniu 21.07.2016, o godz. 13:04:
> 
> 2016-07-21 20:01 GMT+09:00 Pawel Golinski <golpaw1 at gmail.com <mailto:golpaw1 at gmail.com>>:
>> ---
>> src/Backend/MLT/MLTBackend.cpp | 23 +++++++++++++++--------
>> 1 file changed, 15 insertions(+), 8 deletions(-)
>> 
>> diff --git a/src/Backend/MLT/MLTBackend.cpp b/src/Backend/MLT/MLTBackend.cpp
>> index 3d39930..44b9ba9 100644
>> --- a/src/Backend/MLT/MLTBackend.cpp
>> +++ b/src/Backend/MLT/MLTBackend.cpp
>> @@ -54,17 +54,24 @@ MLTBackend::MLTBackend()
>>     m_mltRepo = Mlt::Factory::init();
>>     m_profile.setFrameRate( 2997, 100 );
>> 
>> -    for ( int i = 0; i < m_mltRepo->filters()->count(); ++i )
>> +    if ( m_mltRepo )
> 
> m_mltRepo will never be nullptr.
> 

"m_mltRepo = Mlt::Factory::init();”
This line calls a function which returns a pointer allocated using „new”.

„
Repository *Factory::init( const char *directory )
{
	return new Repository( mlt_factory_init( directory ) );
}
„

So it can.

>>     {
>> -        auto pro = std::unique_ptr<Mlt::Properties>( m_mltRepo->metadata( filter_type, m_mltRepo->filters()->get_name( i ) ) );
>> -        auto filterInfo = new MLTFilterInfo;
>> -        filterInfo->setProperties( pro.get() );
>> -        if ( filterInfo->identifier().empty() == true )
>> +        for ( int i = 0; i < m_mltRepo->filters()->count(); ++i )
>>         {
>> -            delete filterInfo;
>> -            continue;
>> +            auto pro = std::unique_ptr<Mlt::Properties>( m_mltRepo->metadata( filter_type, m_mltRepo->filters()->get_name( i ) ) );
>> +            auto filterInfo = new MLTFilterInfo;
>> +            filterInfo->setProperties( pro.get() );
>> +            if ( filterInfo->identifier().empty() == true )
>> +            {
>> +                delete filterInfo;
>> +                continue;
>> +            }
>> +            m_availableFilters[ filterInfo->identifier() ] = filterInfo;
>>         }
>> -        m_availableFilters[ filterInfo->identifier() ] = filterInfo;
>> +    }
>> +    else
>> +    {
>> +        throw InvalidServiceException();
>>     }
>> }
>> 
>> --
>> 2.7.4 (Apple Git-66)
>> 
>> _______________________________________________
>> Vlmc-devel mailing list
>> Vlmc-devel at videolan.org <mailto:Vlmc-devel at videolan.org>
>> https://mailman.videolan.org/listinfo/vlmc-devel <https://mailman.videolan.org/listinfo/vlmc-devel>
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org <mailto:Vlmc-devel at videolan.org>
> https://mailman.videolan.org/listinfo/vlmc-devel <https://mailman.videolan.org/listinfo/vlmc-devel>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlmc-devel/attachments/20160721/693868dc/attachment.html>


More information about the Vlmc-devel mailing list