<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.xfm15936331
        {mso-style-name:xfm_15936331;}
span.xfmc1
        {mso-style-name:xfmc1;}
span.xfmc2
        {mso-style-name:xfmc2;}
span.xfmc3
        {mso-style-name:xfmc3;}
span.xfmc4
        {mso-style-name:xfmc4;}
span.xfmc8
        {mso-style-name:xfmc8;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;}
span.EmailStyle25
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Iurii<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>I’m confused. There is no difference in the functionality except to resolve the memory leak. H323ExtendedVideoFactory::CreateInstance may return a NULL (unlikely tho’) which also needs to be checked. The change simply separates the CreateInstance, checks for NULL then clone() in basically the same place (another function) as the old implementation.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>You are correct in that VLD like Valgrind detects a leak with the codec factory system with plugin codecs because the codecs are loaded as pointers to the singleton. The singleton is only created at startup and destroyed at shutdown so do not grow on a call-by-call basis. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>There is also a small leak per call with some MediaOptions not being cleaned up. This is an issue as this is on a call-by-call basis. Fixes for that are welcome.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Simon<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Iurii Gordiienko [mailto:hordi@ukr.net] <br><b>Sent:</b> Monday, January 25, 2016 4:27 AM<br><b>To:</b> Simon Horne <s.horne@packetizer.com><br><b>Cc:</b> 'Jan Willamowius' <jan@willamowius.de>; h323plus@lists.packetizer.com<br><b>Subject:</b> Re[2]: [h323plus] Double-delete Capability bug<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>I'm sure - current implementations ::AddCapability are wrong - we should't clone the pointer for <span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>H323CodecExtendedVideoCapability</span></span><span class=xfmc2><span style='font-size:13.5pt;font-family:"Courier New";color:#666666'>::</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>AddCapability</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>(</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>H323Capability</span></span><span style='font-size:13.5pt;font-family:"Courier New"'> <span class=xfmc2><span style='color:#666666'>*</span></span> <span class=xfmc1>capability</span><span class=xfmc3>)</span></span> function and should clone for <span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>H323CodecExtendedVideoCapability</span></span><span class=xfmc2><span style='font-size:13.5pt;font-family:"Courier New";color:#666666'>::</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>AddCapability</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>(</span></span><span class=xfmc4><b><span style='font-size:13.5pt;font-family:"Courier New";color:green'>const</span></b></span><span style='font-size:13.5pt;font-family:"Courier New"'> <span class=xfmc1>PString</span> <span class=xfmc2><span style='color:#666666'>&</span></span> <span class=xfmc1>cap</span><span class=xfmc3>) </span></span>function. I think, Valgrind shows memory leak for case when we are using <span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>extCapabilities</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>.</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>Add</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>(</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>H323ExtendedVideoFactory</span></span><span class=xfmc2><span style='font-size:13.5pt;font-family:"Courier New";color:#666666'>::</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>CreateInstance</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>(</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>cap</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>)->clone()) (forr </span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>H323CodecExtendedVideoCapability</span></span><span class=xfmc2><span style='font-size:13.5pt;font-family:"Courier New";color:#666666'>::</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>AddCapability</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>(</span></span><span class=xfmc4><b><span style='font-size:13.5pt;font-family:"Courier New";color:green'>const</span></b></span><span style='font-size:13.5pt;font-family:"Courier New"'> <span class=xfmc1>PString</span> <span class=xfmc2><span style='color:#666666'>&</span></span> <span class=xfmc1>cap</span><span class=xfmc3>))</span></span> because we have no any default mechanism to clear (delete all capabilities) capabilities factory - we have static factory objects as I remember and Valgrind don't see any desctructor execution. I will write (tomorrow ) simple app and show you proper behavior and destructors execution.<o:p></o:p></p></div><div><p class=MsoNormal>We can't use current version (with clone()) of <span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>H323CodecExtendedVideoCapability</span></span><span class=xfmc2><span style='font-size:13.5pt;font-family:"Courier New";color:#666666'>::</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>AddCapability</span></span><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>(</span></span><span class=xfmc1><span style='font-size:13.5pt;font-family:"Courier New"'>H323Capability</span></span><span style='font-size:13.5pt;font-family:"Courier New"'> <span class=xfmc2><span style='color:#666666'>*</span></span> <span class=xfmc1>capability</span><span class=xfmc3>) </span></span>fuction because that function has been declared as owner of pointer to H323Capability and any user expects that <span style='font-size:13.5pt;font-family:"Courier New"'>H323CodecExtendedVideoCapability </span>object will delete that pointer in own destructor. Whis current modiification we have 100% memory leak because it has not declared behaviour.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=1209 style='width:906.75pt'><tr id=xfmi1><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2023<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span class=xfmc8><span style='font-size:13.5pt;font-family:"Courier New";color:#B00040'>void</span></span><span style='font-size:13.5pt;font-family:"Courier New"'> <span class=xfmc1>H323CodecExtendedVideoCapability</span><span class=xfmc2><span style='color:#666666'>::</span></span><span class=xfmc1>AddCapability</span><span class=xfmc3>(</span><span class=xfmc4><b><span style='color:green'>const</span></b></span> <span class=xfmc1>PString</span> <span class=xfmc2><span style='color:#666666'>&</span></span> <span class=xfmc1>cap</span><span class=xfmc3>)</span><o:p></o:p></span></p></td></tr><tr id=xfmi2><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2024<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>{</span></span><span style='font-size:13.5pt;font-family:"Courier New"'><o:p></o:p></span></p></td></tr><tr id=xfmi3><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2025<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span style='font-size:13.5pt;font-family:"Courier New"'>    <span class=xfmc1>extCapabilities</span><span class=xfmc3>.</span><span class=xfmc1>Add</span><span class=xfmc3>(</span><span class=xfmc1>H323ExtendedVideoFactory</span><span class=xfmc2><span style='color:#666666'>::</span></span><span class=xfmc1>CreateInstance</span><span class=xfmc3>(</span><span class=xfmc1>cap</span><span class=xfmc3>));</span><o:p></o:p></span></p></td></tr><tr id=xfmi4><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2026<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>}</span></span><span style='font-size:13.5pt;font-family:"Courier New"'><o:p></o:p></span></p></td></tr><tr id=xfmi5><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2027<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span style='font-size:13.5pt;font-family:"Courier New"'><o:p> </o:p></span></p></td></tr><tr id=xfmi6><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2028<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span class=xfmc8><span style='font-size:13.5pt;font-family:"Courier New";color:#B00040'>void</span></span><span style='font-size:13.5pt;font-family:"Courier New"'> <span class=xfmc1>H323CodecExtendedVideoCapability</span><span class=xfmc2><span style='color:#666666'>::</span></span><span class=xfmc1>AddCapability</span><span class=xfmc3>(</span><span class=xfmc1>H323Capability</span> <span class=xfmc2><span style='color:#666666'>*</span></span> <span class=xfmc1>capability</span><span class=xfmc3>)</span><o:p></o:p></span></p></td></tr><tr id=xfmi7><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2029<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>{</span></span><span style='font-size:13.5pt;font-family:"Courier New"'><o:p></o:p></span></p></td></tr><tr id=xfmi8><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2030<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span style='font-size:13.5pt;font-family:"Courier New"'>    <span class=xfmc1>extCapabilities</span><span class=xfmc3>.</span><span class=xfmc1>Add</span><span class=xfmc3>((</span><span class=xfmc1>H323Capability</span> <span class=xfmc2><span style='color:#666666'>*</span></span><span class=xfmc3>)</span><span class=xfmc1>capability</span><span class=xfmc2><span style='color:#666666'>-></span></span><span class=xfmc1>Clone</span><span class=xfmc3>());</span><o:p></o:p></span></p></td></tr><tr id=xfmi9><td valign=top style='border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal align=right style='text-align:right'><span style='font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050'>2031<o:p></o:p></span></p></td><td width=1152 valign=top style='width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt'><p class=MsoNormal><span class=xfmc3><span style='font-size:13.5pt;font-family:"Courier New"'>}</span></span><span style='font-size:13.5pt;font-family:"Courier New"'><o:p></o:p></span></p></td></tr></table></div><p class=MsoNormal style='margin-bottom:12.0pt'><span class=xfm15936331><o:p> </o:p></span></p><div><p class=MsoNormal><i><span style='font-size:11.0pt'>--- Original message ---<br>From: "Simon Horne" <<a href="mailto:s.horne@packetizer.com">s.horne@packetizer.com</a>><br>Date: 24 January 2016, 07:23:27</span></i><i><span style='font-size:11.0pt'><o:p></o:p></span></i></p></div><p class=MsoNormal><span class=xfm15936331><o:p> </o:p></span></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><pre>Fix checked in. <o:p></o:p></pre><pre>The first instance is created in<o:p></o:p></pre><pre>H323ExtendedVideoCapability::AddAllCapabilities and a new function<o:p></o:p></pre><pre>H323CodecExtendedVideoCapability::AddCapability(H323Capability *) then<o:p></o:p></pre><pre>clones the first instance. The first instance is then deleted. This will<o:p></o:p></pre><pre>ensure every subsequent call to H323ExtendedVideoFactory::CreateInstance()<o:p></o:p></pre><pre>will create a new unique instance and there is no memory leak.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Simon<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>-----Original Message-----<o:p></o:p></pre><pre>From: h323plus [<a href="mailto:h323plus-bounces@lists.packetizer.com">mailto:h323plus-bounces@lists.packetizer.com</a>] On Behalf Of<o:p></o:p></pre><pre>Jan Willamowius<o:p></o:p></pre><pre>Sent: Sunday, January 24, 2016 2:35 AM<o:p></o:p></pre><pre>To: <a href="mailto:h323plus@lists.packetizer.com" target="_blank">h323plus@lists.packetizer.com</a><o:p></o:p></pre><pre>Subject: Re: [h323plus] Double-delete Capability bug<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Hi Simon,<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>it does need a better fix. But a leak is still better than a crash.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>The proper fix is probably to have CreateInstance() always allocate new<o:p></o:p></pre><pre>memory. But until thats fixed I would leave the Clone() in.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Regards,<o:p></o:p></pre><pre>Jan<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Simon Horne wrote:<o:p></o:p></pre><pre>> Jan<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> As I suspected, I just check with VLD on windows and the change causes <o:p></o:p></pre><pre>> a 9kB/call memory leak (as the capability gets cloned 3 times per <o:p></o:p></pre><pre>> call). Needs to be reverted out.<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> Simon<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> -----Original Message-----<o:p></o:p></pre><pre>> From: h323plus [<a href="mailto:h323plus-bounces@lists.packetizer.com">mailto:h323plus-bounces@lists.packetizer.com</a>] On <o:p></o:p></pre><pre>> Behalf Of Jan Willamowius<o:p></o:p></pre><pre>> Sent: Saturday, January 23, 2016 4:49 AM<o:p></o:p></pre><pre>> To: <a href="mailto:h323plus@lists.packetizer.com" target="_blank">h323plus@lists.packetizer.com</a><o:p></o:p></pre><pre>> Subject: Re: [h323plus] Double-delete Capability bug<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> Hi Iurii,<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> I have added the Clone() in the CVS, but could you please check (wg.<o:p></o:p></pre><pre>> with Valgrind) if we now have a memory leak in some cases instead of a <o:p></o:p></pre><pre>> crash ?<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> Regards,<o:p></o:p></pre><pre>> Jan<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> --<o:p></o:p></pre><pre>> Jan Willamowius, Founder of the GNU Gatekeeper Project EMail  :<o:p></o:p></pre><pre>> <a href="mailto:jan@willamowius.de" target="_blank">jan@willamowius.de</a><o:p></o:p></pre><pre>> Website: <a href="http://www.gnugk.org" target="_blank">http://www.gnugk.org</a><o:p></o:p></pre><pre>> Support: <a href="http://www.willamowius.com/gnugk-support.html" target="_blank">http://www.willamowius.com/gnugk-support.html</a><o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> Relaxed Communications GmbH<o:p></o:p></pre><pre>> Frahmredder 91<o:p></o:p></pre><pre>> 22393 Hamburg<o:p></o:p></pre><pre>> Geschäftsführer: Jan Willamowius<o:p></o:p></pre><pre>> HRB 125261 (Amtsgericht Hamburg)<o:p></o:p></pre><pre>> USt-IdNr: DE286003584<o:p></o:p></pre><pre>> <o:p></o:p></pre><pre>> Iurii Gordiienko wrote:<o:p></o:p></pre><pre>> > Hi,<o:p></o:p></pre><pre>> > I have found something... For<o:p></o:p></pre><pre>> H323ExtendedVideoCapability::AddAllCapabilities function we are using <o:p></o:p></pre><pre>> H323CodecExtendedVideoCapability::AddCapability function for<o:p></o:p></pre><pre>> extCapability->AddCapability(*r).<o:p></o:p></pre><pre>> H323CodecExtendedVideoCapability::AddCapability function uses<o:p></o:p></pre><pre>> extCapabilities.Add(H323ExtendedVideoFactory::CreateInstance(cap))<o:p></o:p></pre><pre>function.<o:p></o:p></pre><pre>> The function H323ExtendedVideoFactory::CreateInstance(cap) will call "new"<o:p></o:p></pre><pre>> if any same "cap" does not is exists for now< for other case it will <o:p></o:p></pre><pre>> return the pointer to current actual Capability. But <o:p></o:p></pre><pre>> H323CodecExtendedVideoCapability::extCapabilities will delete all <o:p></o:p></pre><pre>> items in time of execution  extCapabilities.RemoveAll() function from <o:p></o:p></pre><pre>> H323CodecExtendedVideoCapability::~H323CodecExtendedVideoCapability().<o:p></o:p></pre><pre>> In result we have "double delete" and undefined behavior (crash for <o:p></o:p></pre><pre>> worst case).<o:p></o:p></pre><pre>> > <o:p></o:p></pre><pre>> > --------------------------------<o:p></o:p></pre><pre>> > void H323ExtendedVideoCapability::AddAllCapabilities(<o:p></o:p></pre><pre>> H323Capabilities & basecapabilities, PINDEX descriptorNum,PINDEX<o:p></o:p></pre><pre>> simultaneous) {   H323ExtendedVideoFactory::KeyList_T extCaps = <o:p></o:p></pre><pre>> H323ExtendedVideoFactory::GetKeyList();   if (extCaps.size() > 0) { <o:p></o:p></pre><pre>> H323CodecExtendedVideoCapability * capability = new <o:p></o:p></pre><pre>> H323CodecExtendedVideoCapability();<o:p></o:p></pre><pre>> H323ExtendedVideoFactory::KeyList_T::const_iterator r;         PINDEX <o:p></o:p></pre><pre>> num = P_MAX_INDEX;         for (r = extCaps.begin(); r != <o:p></o:p></pre><pre>> extCaps.end(); ++r) {<o:p></o:p></pre><pre>>          H323CodecExtendedVideoCapability * extCapability = <o:p></o:p></pre><pre>> (H323CodecExtendedVideoCapability *)capability->Clone();<o:p></o:p></pre><pre>>  extCapability->AddCapability(*r);            num = <o:p></o:p></pre><pre>> basecapabilities.SetCapability(descriptorNum, <o:p></o:p></pre><pre>> simultaneous,extCapability);<o:p></o:p></pre><pre>>          simultaneous = num;         }     simultaneous = P_MAX_INDEX; <o:p></o:p></pre><pre>> basecapabilities.SetCapability(descriptorNum, simultaneous,new <o:p></o:p></pre><pre>> H323ControlExtendedVideoCapability());  !<o:p></o:p></pre><pre>> >     delete capability;   }  }<o:p></o:p></pre><pre>> > void H323CodecExtendedVideoCapability::AddCapability(const PString &<o:p></o:p></pre><pre>> > cap) {<o:p></o:p></pre><pre>> > extCapabilities.Add(H323ExtendedVideoFactory::CreateInstance(cap)); <o:p></o:p></pre><pre>> > }<o:p></o:p></pre><pre>> > <o:p></o:p></pre><pre>> > -------------------------------------------------<o:p></o:p></pre><pre>> > I propose to replace the "void<o:p></o:p></pre><pre>> H323CodecExtendedVideoCapability::AddCapability(const PString & cap)" <o:p></o:p></pre><pre>> to this one:<o:p></o:p></pre><pre>> > void H323CodecExtendedVideoCapability::AddCapability(const PString &<o:p></o:p></pre><pre>> > cap) {<o:p></o:p></pre><pre>> > extCapabilities.Add(H323ExtendedVideoFactory::CreateInstance(cap)->c<o:p></o:p></pre><pre>> > lo<o:p></o:p></pre><pre>> > ne()); }<o:p></o:p></pre><pre>> > <o:p></o:p></pre><pre>> > <o:p></o:p></pre><pre>> > <o:p></o:p></pre><pre>> > Thanks -- Iurii Gordiienko<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre></blockquote><p class=MsoNormal><img border=0 width=1 height=1 id="_x0000_i1025" src="https://mail.ukr.net/api/public/message_read?a=nKmgvdFnKHmsk7uvZLEpXibnDNU6F8_qU1ZGc7zEJB-vdUcJx5CB_-1itriBdHD13nlyTrTQ8rTFlWqJAzfnfYiae8iJaxgScA=="><o:p></o:p></p></div></body></html>