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

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


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


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/40/7640/1

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index c080bfe..4a0dacc 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -5373,6 +5373,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;
 
@@ -5382,7 +5383,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");
 
@@ -13212,6 +13212,7 @@
 	}
 
 	if (separate_mailbox(ast_strdupa(stasis_topic_name(change->topic)), &mailbox, &context)) {
+		ast_free(mwist);
 		return;
 	}
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6282c542ff7b82fa091177a912d11234a8b00a30
Gerrit-Change-Number: 7640
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/037abdc1/attachment.html>


More information about the asterisk-code-review mailing list