<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6292">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_smdi: Clean up memory leak<br><br>Change-Id: I1e33290929e1aa7c5b9cb513f8254f2884974de8<br>---<br>M res/res_smdi.c<br>1 file changed, 4 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/92/6292/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_smdi.c b/res/res_smdi.c<br>index e2e5b17..bf69d68 100644<br>--- a/res/res_smdi.c<br>+++ b/res/res_smdi.c<br>@@ -608,12 +608,11 @@<br> <br> ast_debug(1, "Read a 'D' ... it's an MD message.\n");<br> <br>- if (!(md_msg = ast_calloc(1, sizeof(*md_msg)))) {<br>+ md_msg = ao2_alloc(sizeof(*md_msg), NULL);<br>+ if (!ms_msg) {<br> ao2_ref(iface, -1);<br> return NULL;<br> }<br>-<br>- md_msg = ao2_alloc(sizeof(*md_msg), NULL);<br> <br> /* read the message desk number */<br> for (i = 0; i < sizeof(md_msg->mesg_desk_num) - 1; i++) {<br>@@ -710,12 +709,11 @@<br> <br> ast_debug(1, "Read a 'W', it's an MWI message. (No more debug coming for MWI messages)\n");<br> <br>- if (!(mwi_msg = ast_calloc(1, sizeof(*mwi_msg)))) {<br>+ mwi_msg = ao2_alloc(sizeof(*mwi_msg), NULL);<br>+ if (!mwi_msg) {<br> ao2_ref(iface, -1);<br> return NULL;<br> }<br>-<br>- mwi_msg = ao2_alloc(sizeof(*mwi_msg), NULL);<br> <br> /* discard the 'I' (from 'MWI') */<br> fgetc(iface->file);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6292">change 6292</a>. To unsubscribe, 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/6292"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I1e33290929e1aa7c5b9cb513f8254f2884974de8 </div>
<div style="display:none"> Gerrit-Change-Number: 6292 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>