[Asterisk-code-review] res smdi: Clean up memory leak (asterisk[14])
Sean Bright
asteriskteam at digium.com
Thu Aug 24 08:37:50 CDT 2017
Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/6290
Change subject: res_smdi: Clean up memory leak
......................................................................
res_smdi: Clean up memory leak
Change-Id: I1e33290929e1aa7c5b9cb513f8254f2884974de8
---
M res/res_smdi.c
1 file changed, 4 insertions(+), 6 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/6290/1
diff --git a/res/res_smdi.c b/res/res_smdi.c
index 225a491..b5b0a64 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -610,12 +610,11 @@
ast_debug(1, "Read a 'D' ... it's an MD message.\n");
- if (!(md_msg = ast_calloc(1, sizeof(*md_msg)))) {
+ md_msg = ao2_alloc(sizeof(*md_msg), NULL);
+ if (!ms_msg) {
ao2_ref(iface, -1);
return NULL;
}
-
- md_msg = ao2_alloc(sizeof(*md_msg), NULL);
/* read the message desk number */
for (i = 0; i < sizeof(md_msg->mesg_desk_num) - 1; i++) {
@@ -712,12 +711,11 @@
ast_debug(1, "Read a 'W', it's an MWI message. (No more debug coming for MWI messages)\n");
- if (!(mwi_msg = ast_calloc(1, sizeof(*mwi_msg)))) {
+ mwi_msg = ao2_alloc(sizeof(*mwi_msg), NULL);
+ if (!mwi_msg) {
ao2_ref(iface, -1);
return NULL;
}
-
- mwi_msg = ao2_alloc(sizeof(*mwi_msg), NULL);
/* discard the 'I' (from 'MWI') */
fgetc(iface->file);
--
To view, visit https://gerrit.asterisk.org/6290
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e33290929e1aa7c5b9cb513f8254f2884974de8
Gerrit-Change-Number: 6290
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170824/1d9ca593/attachment.html>
More information about the asterisk-code-review
mailing list