[mythtv-commits] Ticket #13106: Mythtv Video Service API GetVideoByFileName memory leak

MythTV noreply at mythtv.org
Fri Aug 18 05:23:06 UTC 2017


#13106: Mythtv Video Service API GetVideoByFileName memory leak
-------------------------------------------------+-------------------------
     Reporter:  rich@…                           |      Owner:  bmeek
         Type:  Bug Report - Memory Leak         |     Status:  new
     Priority:  minor                            |  Milestone:
                                                 |  needs_triage
    Component:  MythTV - Services API - Backend  |    Version:  0.28.1
     Severity:  low                              |   Keywords:
Ticket locked:  0                                |
-------------------------------------------------+-------------------------
 The DTC::VideoMetadataInfo* Video::GetVideoByFileName( const QString
 &FileName ) function in mythtv/programs/mythbackend/services/video.cpp can
 leak memory.

 A VideoMetadataListManager instance is heap allocated and afterwards the
 function can throw an exception without deleting the heap allocated
 instance.  This can be seen in the function definition below:


 {{{
 TC::VideoMetadataInfo* Video::GetVideoByFileName( const QString &FileName
 )
 {
     VideoMetadataListManager::metadata_list videolist;
     VideoMetadataListManager::loadAllFromDatabase(videolist);
     VideoMetadataListManager *mlm = new VideoMetadataListManager();
     mlm->setList(videolist);
     VideoMetadataListManager::VideoMetadataPtr metadata =
 mlm->byFilename(FileName);

     if ( !metadata )
         throw( QString( "No metadata found for selected filename!." ));

     DTC::VideoMetadataInfo *pVideoMetadataInfo = new
 DTC::VideoMetadataInfo();

     FillVideoMetadataInfo ( pVideoMetadataInfo, metadata, true );

     delete mlm;

     return pVideoMetadataInfo;
 }
 }}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13106>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list