<p><a href="https://gerrit.asterisk.org/c/asterisk/+/11579">View Change</a></p><p>3 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/11579/10/apps/app_audiosocket.c">File apps/app_audiosocket.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11579/10/apps/app_audiosocket.c@156">Patch Set #10, Line 156:</a> <code style="font-family:monospace,monospace">             if (!(f = ast_audiosocket_receive_frame(svc))) {</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I don't understand.  I'm freeing it in both the error and non-error conditions. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Within this function you are not freeing the frame returned by ast_audiosocket_receive_frame. That's what I was referring to. Frames should always be freed, or else you are depending on specific implementation knowledge to know that it is or is not necessary.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/11579/10/channels/chan_audiosocket.c">File channels/chan_audiosocket.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11579/10/channels/chan_audiosocket.c@136">Patch Set #10, Line 136:</a> <code style="font-family:monospace,monospace">        struct audiosocket_instance *instance;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I _think_ this addresses your concern (added NULL set to failure label), but I don't see any conditi […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">At line 172 you allocate this structure.<br>At line 184 is a failure case, this returns without freeing the above structure causing a leak. The same occurs at 185, 195, and 203.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/11579/10/include/asterisk/res_audiosocket.h">File include/asterisk/res_audiosocket.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11579/10/include/asterisk/res_audiosocket.h@84">Patch Set #10, Line 84:</a> <code style="font-family:monospace,monospace"> * \retval A \ref ast_frame on success</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Pardon my ignorance, but I would assume that would depend on the caller, no?  If it is processed int […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Yes, that is my intention. APIs should be explicit in stating the required behavior so that an assumption isn't made, with an assumption the result can be a memory leak.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11579">change 11579</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11579"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ie866e6c4fa13178ec76f2a6971ad3590a3a588b5 </div>
<div style="display:none"> Gerrit-Change-Number: 11579 </div>
<div style="display:none"> Gerrit-PatchSet: 12 </div>
<div style="display:none"> Gerrit-Owner: Seán C. McCord <ulexus@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Seán C. McCord <ulexus@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Sat, 24 Aug 2019 11:40:28 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: Seán C. McCord <ulexus@gmail.com> </div>
<div style="display:none"> Comment-In-Reply-To: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>