<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Ross, <div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; ">   </span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "> </span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "><span style="color: rgb(189, 35, 160); ">delete</span></span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; ">[] sPropRecords;</span></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">with the error that the "pointer being freed was not allocated".</span></div></div></div></div></blockquote><div><br></div>I don't understand why you're getting an error here; the code looks OK.</div></div></blockquote><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Yeah, I know the feeling!  ;-) But it would seem more than an issue of style, it outright crashes the entire app...</div><div><br></div></div></div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>FYI, in C++ "delete[]"ing (or "delete"ing) a NULL pointer is not an error (it has no effect).<br></div></div></blockquote><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Yeah...I've been wondering if I'm dealing with some compiler nuance in part. I did that to see if it would have any marked effect on the outcome. </div><div><br></div><div>The only way I can get a run that doesn't crash is to remove the </div><div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; ">   </span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "> </span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "><span style="color: rgb(189, 35, 160); ">delete</span></span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; ">[] sPropRecords;</span></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "></span></div></div></div></div></blockquote></div></div></blockquote></div><div><br></div><div>line entirely, and as a result, the memory....</div><div><br></div><div>Brad</div><div><br></div></div></div><div><div>On Mar 6, 2012, at 3:16 PM, Ross Finlayson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">This particular code snippet was taken directly from the Live555 H264VideoFileSink class implementation of its afterGettingFrame() method, so the exact code and usage context should be identical. </span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">Anyway, I have taken my app run it on Xcode, and this line pretty quickly crashes the app: </span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; ">   </span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "> </span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "><span style="color: rgb(189, 35, 160); ">delete</span></span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; ">[] sPropRecords;</span></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">with the error that the "pointer being freed was not allocated". </span></div></div></div></div></blockquote><div><br></div>I don't understand why you're getting an error here; the code looks OK.</div><div><br></div><div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">I then figured that there was something internal to the parseSPropParameterSets which might conditionally allocate sPropRecords. So I wrapped the delete in a conditional: </span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">    <span style="color: #bd23a0">if</span> (sPropRecords)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">    {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">        <span style="color: #bd23a0">delete</span>[] sPropRecords;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">    }</div><div><br></div><div>The error was the same</div></span></div></div></div></div></blockquote><div><br></div>FYI, in C++ "delete[]"ing (or "delete"ing) a NULL pointer is not an error (it has no effect).<br></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></div>_______________________________________________<br>live-devel mailing list<br><a href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a><br>http://lists.live555.com/mailman/listinfo/live-devel<br></blockquote></div><br></div></body></html>