[Asterisk-code-review] app voicemail: Fix memory management issues. (asterisk[15])

Corey Farrell asteriskteam at digium.com
Mon Dec 18 18:12:23 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7639


Change subject: app_voicemail: Fix memory management issues.
......................................................................

app_voicemail: Fix memory management issues.

* mwi_sub_event_cb: mwist leaked on separate_mailbox failure.
* add_email_attachment: A reference to sox_gain_tmpdir was used
  after the storage was out of scope.

Change-Id: I6282c542ff7b82fa091177a912d11234a8b00a30
---
M apps/app_voicemail.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/39/7639/1

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index d017301..01111a1 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -5371,6 +5371,7 @@
 static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format, char *attach, char *greeting_attachment, char *mailbox, char *bound, char *filename, int last, int msgnum)
 {
 	char fname[PATH_MAX] = "";
+	char sox_gain_tmpdir[PATH_MAX];
 	char *file_to_delete = NULL, *dir_to_delete = NULL;
 	int res;
 
@@ -5380,7 +5381,6 @@
 	/* This 'while' loop will only execute once. We use it so that we can 'break' */
 	while (vmu->volgain < -.001 || vmu->volgain > .001) {
 		char tmpdir[PATH_MAX];
-		char sox_gain_tmpdir[PATH_MAX];
 
 		create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
 
@@ -13148,6 +13148,7 @@
 	}
 
 	if (separate_mailbox(ast_strdupa(stasis_topic_name(change->topic)), &mailbox, &context)) {
+		ast_free(mwist);
 		return;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/7639
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6282c542ff7b82fa091177a912d11234a8b00a30
Gerrit-Change-Number: 7639
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171218/737d4f47/attachment.html>


More information about the asterisk-code-review mailing list