summaryrefslogtreecommitdiff
path: root/res/res_smdi.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-08-24 09:35:45 -0400
committerSean Bright <sean.bright@gmail.com>2017-08-24 08:39:50 -0500
commit7937d5b8b3f4c5ccac64e0646afb46448e1db63c (patch)
tree075db21ed7dec6d0248d2582dcf07e3420667b3b /res/res_smdi.c
parent5570cf22faa3c4eab37dfd09873ebcf97fd6e64b (diff)
res_smdi: Clean up memory leak
Change-Id: I1e33290929e1aa7c5b9cb513f8254f2884974de8
Diffstat (limited to 'res/res_smdi.c')
-rw-r--r--res/res_smdi.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/res/res_smdi.c b/res/res_smdi.c
index e2e5b17ba..7f9af5cd5 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -608,13 +608,12 @@ static void *smdi_read(void *iface_p)
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 (!md_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++) {
md_msg->mesg_desk_num[i] = fgetc(iface->file);
@@ -710,13 +709,12 @@ static void *smdi_read(void *iface_p)
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);