Changeset 5581


Ignore:
Timestamp:
Apr 10, 2017 6:30:01 AM (8 years ago)
Author:
ming
Message:

Fixed #2011: Fixed crash when accessing video device info in pjsua2

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua2/media.hpp

    r5273 r5581  
    109109 
    110110/** Array of MediaFormat */ 
    111 typedef std::vector<MediaFormat*> MediaFormatVector; 
     111typedef std::vector<MediaFormat> MediaFormatVector; 
    112112 
    113113/** 
  • pjproject/trunk/pjsip/src/pjsua2/media.cpp

    r5273 r5581  
    599599 
    600600    for (unsigned i=0; i<dev_info.ext_fmt_cnt;++i) { 
    601         MediaFormatAudio *format = new MediaFormatAudio; 
    602  
    603         format->fromPj(dev_info.ext_fmt[i]); 
    604         if (format->type == PJMEDIA_TYPE_AUDIO) 
     601        MediaFormatAudio format; 
     602        format.fromPj(dev_info.ext_fmt[i]); 
     603        if (format.type == PJMEDIA_TYPE_AUDIO) 
    605604            extFmt.push_back(format); 
    606605    } 
     
    609608AudioDevInfo::~AudioDevInfo() 
    610609{ 
    611     for(unsigned i=0;i<extFmt.size();++i) { 
    612         delete extFmt[i]; 
    613     } 
    614     extFmt.clear(); 
    615610} 
    616611 
     
    12651260 
    12661261    for (unsigned i = 0; i<dev_info.fmt_cnt;++i) { 
    1267         MediaFormatVideo *format = new MediaFormatVideo; 
    1268  
    1269         format->fromPj(dev_info.fmt[i]); 
    1270         if (format->type == PJMEDIA_TYPE_VIDEO) 
     1262        MediaFormatVideo format; 
     1263        format.fromPj(dev_info.fmt[i]); 
     1264        if (format.type == PJMEDIA_TYPE_VIDEO) 
    12711265            fmt.push_back(format); 
    12721266    } 
     
    12781272VideoDevInfo::~VideoDevInfo() 
    12791273{ 
    1280 #if PJSUA_HAS_VIDEO 
    1281     for (unsigned i = 0;i<fmt.size();++i) { 
    1282         delete fmt[i]; 
    1283     } 
    1284     fmt.clear(); 
    1285 #endif 
    12861274} 
    12871275 
Note: See TracChangeset for help on using the changeset viewer.