diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-12 17:49:20 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-12 17:49:20 +0000 |
commit | bf655a179a740e0e8593ad5655a03121779051c0 (patch) | |
tree | fbb0fcb904e17c0f80952f35a1b712d983a1950f /apps/app_voicemail.c | |
parent | 8b521b183b9d35739aeee8925b3c36f76f17b4f5 (diff) |
Merged revisions 193870 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r193870 | tilghman | 2009-05-12 12:29:33 -0500 (Tue, 12 May 2009) | 2 lines
Convert a THREADSTORAGE object into a simple malloc'd object (as suggested by Russell on -dev)
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@193873 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r-- | apps/app_voicemail.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 1a1650b2b..0785bce50 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -415,8 +415,6 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate); #define ERROR_LOCK_PATH -100 -AST_THREADSTORAGE(voicemail_extension_list); - enum { NEW_FOLDER, OLD_FOLDER, @@ -5027,8 +5025,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ char fmt[80]; char *context; char ecodes[17] = "#"; + struct ast_str *tmp = ast_str_create(16); char *tmpptr; - struct ast_str *tmp = ast_str_thread_get(&voicemail_extension_list, 16); struct ast_vm_user *vmu; struct ast_vm_user svm; const char *category = NULL; @@ -5066,6 +5064,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (!(vmu = find_user(&svm, context, ext))) { ast_log(AST_LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext); pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED"); + ast_free(tmp); return res; } /* Setup pre-file if appropriate */ @@ -5091,6 +5090,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, ext); if ((res = create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, ext, "tmp"))) { ast_log(AST_LOG_WARNING, "Failed to make directory (%s)\n", tempfile); + ast_free(tmp); return -1; } RETRIEVE(tempfile, -1, vmu->mailbox, vmu->context); @@ -5161,6 +5161,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ ast_debug(1, "Hang up during prefile playback\n"); free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED"); + ast_free(tmp); return -1; } } @@ -5191,6 +5192,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ chan->priority = 0; free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); + ast_free(tmp); return 0; } @@ -5210,6 +5212,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); } + ast_free(tmp); return 0; } @@ -5219,12 +5222,14 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ ast_copy_string(chan->context, options->exitcontext, sizeof(chan->context)); free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); + ast_free(tmp); return res; } if (res < 0) { free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED"); + ast_free(tmp); return -1; } /* The meat of recording the message... All the announcements and beeps have been played*/ @@ -5238,6 +5243,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ res = inboxcount(ext_context, &newmsgs, &oldmsgs); if (res < 0) { ast_log(AST_LOG_NOTICE, "Can not leave voicemail, unable to count messages\n"); + ast_free(tmp); return -1; } if (!(vms = get_vm_state_by_mailbox(ext, context, 0))) { @@ -5247,6 +5253,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ */ if (!(vms = create_vm_state_from_user(vmu))) { ast_log(AST_LOG_ERROR, "Couldn't allocate necessary space\n"); + ast_free(tmp); return -1; } } @@ -5264,6 +5271,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (vms->quota_limit && vms->quota_usage >= vms->quota_limit) { ast_debug(1, "*** QUOTA EXCEEDED!! %u >= %u\n", vms->quota_usage, vms->quota_limit); ast_play_and_wait(chan, "vm-mailboxfull"); + ast_free(tmp); return -1; } @@ -5271,6 +5279,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (msgnum >= vmu->maxmsg) { ast_log(AST_LOG_WARNING, "Unable to leave message since we will exceed the maximum number of messages allowed (%u > %u)\n", msgnum, vmu->maxmsg); ast_play_and_wait(chan, "vm-mailboxfull"); + ast_free(tmp); return -1; } #else @@ -5478,7 +5487,8 @@ leave_vm_out: ast_mutex_unlock(&vms->lock); } #endif - + + ast_free(tmp); return res; } |