[asterisk-commits] tilghman: branch 1.6.1 r193872 - in /branches/1.6.1: ./ apps/app_voicemail.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 12 12:48:34 CDT 2009
Author: tilghman
Date: Tue May 12 12:48:30 2009
New Revision: 193872
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=193872
Log:
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)
........
Modified:
branches/1.6.1/ (props changed)
branches/1.6.1/apps/app_voicemail.c
Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.1/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/apps/app_voicemail.c?view=diff&rev=193872&r1=193871&r2=193872
==============================================================================
--- branches/1.6.1/apps/app_voicemail.c (original)
+++ branches/1.6.1/apps/app_voicemail.c Tue May 12 12:48:30 2009
@@ -231,8 +231,6 @@
#define VM_FWDURGAUTO (1 << 18) /*!< Autoset of Urgent flag on forwarded Urgent messages set globally */
#define ERROR_LOCK_PATH -100
-
-AST_THREADSTORAGE(voicemail_extension_list);
enum {
NEW_FOLDER,
@@ -4901,8 +4899,8 @@
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;
@@ -4940,6 +4938,7 @@
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 */
@@ -4965,6 +4964,7 @@
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);
@@ -5035,6 +5035,7 @@
ast_debug(1, "Hang up during prefile playback\n");
free_user(vmu);
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+ ast_free(tmp);
return -1;
}
}
@@ -5065,6 +5066,7 @@
chan->priority = 0;
free_user(vmu);
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
+ ast_free(tmp);
return 0;
}
@@ -5084,6 +5086,7 @@
free_user(vmu);
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
}
+ ast_free(tmp);
return 0;
}
@@ -5093,12 +5096,14 @@
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*/
@@ -5112,6 +5117,7 @@
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))) {
@@ -5121,6 +5127,7 @@
*/
if (!(vms = create_vm_state_from_user(vmu))) {
ast_log(AST_LOG_ERROR, "Couldn't allocate necessary space\n");
+ ast_free(tmp);
return -1;
}
}
@@ -5138,6 +5145,7 @@
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;
}
@@ -5145,6 +5153,7 @@
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
@@ -5355,7 +5364,8 @@
ast_mutex_unlock(&vms->lock);
}
#endif
-
+
+ ast_free(tmp);
return res;
}
More information about the asterisk-commits
mailing list