Merged revisions 53045 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r53045 | russell | 2007-01-31 15:25:11 -0600 (Wed, 31 Jan 2007) | 3 lines

Fix a bunch of places where pthread_attr_init() was called, but
pthread_attr_destroy() was not.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@53046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2007-01-31 21:32:08 +00:00
parent 43e68cac9a
commit 9aab046002
15 changed files with 47 additions and 8 deletions

View File

@@ -3591,9 +3591,6 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
pthread_attr_t attr;
struct ast_channel *chan;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
index = zt_get_index(ast, p, 0);
mysig = p->sig;
if (p->outsigmod > -1)
@@ -4178,6 +4175,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if (res)
ast_log(LOG_WARNING, "Unable to start dial recall tone on channel %d\n", p->channel);
p->owner = chan;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (!chan) {
ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", p->channel);
} else if (ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
@@ -4195,7 +4194,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
}
p->subs[SUB_THREEWAY].needhold = 1;
}
}
pthread_attr_destroy(&attr);
}
} else {
/* Already have a 3 way call */
@@ -6686,6 +6686,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
"interface %d\n", i->channel);
}
}
pthread_attr_destroy(&attr);
return 0;
}
@@ -6908,10 +6909,12 @@ static int restart_monitor(void)
if (ast_pthread_create_background(&monitor_thread, &attr, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
pthread_attr_destroy(&attr);
return -1;
}
}
ast_mutex_unlock(&monlock);
pthread_attr_destroy(&attr);
return 0;
}
@@ -8248,9 +8251,6 @@ static void *pri_dchannel(void *vpri)
char plancallingani[256];
char calledtonstr[10];
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
gettimeofday(&lastidle, NULL);
if (!ast_strlen_zero(pri->idledial) && !ast_strlen_zero(pri->idleext)) {
/* Need to do idle dialing, check to be sure though */
@@ -8741,6 +8741,8 @@ static void *pri_dchannel(void *vpri)
pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
ast_mutex_lock(&pri->lock);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
@@ -8756,6 +8758,7 @@ static void *pri_dchannel(void *vpri)
pri->pvts[chanpos]->call = NULL;
}
}
pthread_attr_destroy(&attr);
} else {
ast_mutex_unlock(&pri->lock);
/* Release PRI lock while we create the channel */