<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8128">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">manager_channels.c: Reordered ast_manager_build_channel_state_string_prefix()<br><br>* Made not allocate memory if the channel snapshot is an internal channel.<br><br>* Free memory earlier when no longer needed.<br><br>Change-Id: Ia06e0c065f1bd095781aa3f4a626d58fa4d28b38<br>---<br>M main/manager_channels.c<br>1 file changed, 10 insertions(+), 11 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/28/8128/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/manager_channels.c b/main/manager_channels.c<br>index 81dafd7..37269a9 100644<br>--- a/main/manager_channels.c<br>+++ b/main/manager_channels.c<br>@@ -488,16 +488,17 @@<br>                 const struct ast_channel_snapshot *snapshot,<br>          const char *prefix)<br> {<br>-      struct ast_str *out = ast_str_create(1024);<br>-  int res = 0;<br>- char *caller_name, *connected_name;<br>+  struct ast_str *out;<br>+ char *caller_name;<br>+   char *connected_name;<br>+        int res;<br> <br>-  if (!out) {<br>+  if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {<br>                return NULL;<br>  }<br> <br>- if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {<br>-               ast_free(out);<br>+       out = ast_str_create(1024);<br>+  if (!out) {<br>           return NULL;<br>  }<br> <br>@@ -534,10 +535,11 @@<br>           prefix, snapshot->uniqueid,<br>                prefix, snapshot->linkedid);<br> <br>+   ast_free(caller_name);<br>+       ast_free(connected_name);<br>+<br>  if (!res) {<br>           ast_free(out);<br>-               ast_free(caller_name);<br>-               ast_free(connected_name);<br>             return NULL;<br>  }<br> <br>@@ -552,9 +554,6 @@<br>                     ast_free(val);<br>                }<br>     }<br>-<br>- ast_free(caller_name);<br>-       ast_free(connected_name);<br> <br>  return out;<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8128">change 8128</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/8128"/><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: Ia06e0c065f1bd095781aa3f4a626d58fa4d28b38 </div>
<div style="display:none"> Gerrit-Change-Number: 8128 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>