aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-19 20:12:20 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-19 20:12:20 +0000
commite7a2891b57c9b1e480fb0f934fc3d257745b7594 (patch)
tree160167df4a86257febd6d50d27b4c2fc98b7c955
parentf28c4584cc21af5f39e72de47f89da6aed0012b6 (diff)
Ensure thread keys are initialized before attempting to access them.
(closes issue #14889) Reported by: jaroth Patches: app_voicemail.c.patch uploaded by msirota (license 758) Tested by: msirota, BlargMaN git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@195520 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_voicemail.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 0509559bb..9b05d2b3b 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1904,6 +1904,7 @@ static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu)
{
struct vm_state *vms_p;
+ pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
if ((vms_p = pthread_getspecific(ts_vmstate.key)) && !strcmp(vms_p->imapuser, vmu->imapuser) && !strcmp(vms_p->username, vmu->mailbox)) {
return vms_p;
}
@@ -1931,6 +1932,7 @@ static struct vm_state *get_vm_state_by_imapuser(char *user, int interactive)
if (interactive) {
struct vm_state *vms;
+ pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
vms = pthread_getspecific(ts_vmstate.key);
return vms;
}
@@ -1972,6 +1974,7 @@ static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, const char
if (interactive) {
struct vm_state *vms;
+ pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
vms = pthread_getspecific(ts_vmstate.key);
return vms;
}