[asterisk-commits] tilghman: branch 1.4 r195520 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 19 15:12:26 CDT 2009


Author: tilghman
Date: Tue May 19 15:12:20 2009
New Revision: 195520

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=195520
Log:
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

Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=195520&r1=195519&r2=195520
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Tue May 19 15:12:20 2009
@@ -1904,6 +1904,7 @@
 {
 	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 @@
 
 	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 @@
 
 	if (interactive) {
 		struct vm_state *vms;
+		pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
 		vms = pthread_getspecific(ts_vmstate.key);
 		return vms;
 	}




More information about the asterisk-commits mailing list