From: Corey Farrell Date: Tue, 19 Dec 2017 00:04:56 +0000 (-0500) Subject: app_voicemail: Fix memory management issues. X-Git-Tag: 15.2.0-rc1~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2a1425ed6a35454990afbea4f8304675eb8f369;p=thirdparty%2Fasterisk.git 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 --- diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index d01730101b..01111a1aa7 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -5371,6 +5371,7 @@ plain_message: 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 @@ static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format, /* 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 @@ static void mwi_sub_event_cb(struct stasis_subscription_change *change) } if (separate_mailbox(ast_strdupa(stasis_topic_name(change->topic)), &mailbox, &context)) { + ast_free(mwist); return; }