[Asterisk-code-review] manager channels.c: Reordered ast manager build channel stat... (asterisk[13])
Jenkins2
asteriskteam at digium.com
Sat Feb 3 10:03:19 CST 2018
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/8126 )
Change subject: manager_channels.c: Reordered ast_manager_build_channel_state_string_prefix()
......................................................................
manager_channels.c: Reordered ast_manager_build_channel_state_string_prefix()
* Made not allocate memory if the channel snapshot is an internal channel.
* Free memory earlier when no longer needed.
Change-Id: Ia06e0c065f1bd095781aa3f4a626d58fa4d28b38
---
M main/manager_channels.c
1 file changed, 10 insertions(+), 11 deletions(-)
Approvals:
Corey Farrell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
Sean Bright: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/main/manager_channels.c b/main/manager_channels.c
index 71c1732..6938c6e 100644
--- a/main/manager_channels.c
+++ b/main/manager_channels.c
@@ -463,16 +463,17 @@
const struct ast_channel_snapshot *snapshot,
const char *prefix)
{
- struct ast_str *out = ast_str_create(1024);
- int res = 0;
- char *caller_name, *connected_name;
+ struct ast_str *out;
+ char *caller_name;
+ char *connected_name;
+ int res;
- if (!out) {
+ if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {
return NULL;
}
- if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {
- ast_free(out);
+ out = ast_str_create(1024);
+ if (!out) {
return NULL;
}
@@ -509,10 +510,11 @@
prefix, snapshot->uniqueid,
prefix, snapshot->linkedid);
+ ast_free(caller_name);
+ ast_free(connected_name);
+
if (!res) {
ast_free(out);
- ast_free(caller_name);
- ast_free(connected_name);
return NULL;
}
@@ -527,9 +529,6 @@
ast_free(val);
}
}
-
- ast_free(caller_name);
- ast_free(connected_name);
return out;
}
--
To view, visit https://gerrit.asterisk.org/8126
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia06e0c065f1bd095781aa3f4a626d58fa4d28b38
Gerrit-Change-Number: 8126
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180203/56c826e9/attachment-0001.html>
More information about the asterisk-code-review
mailing list