2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

3079. [bug] Handle isc_event_allocate failures in t_tasks.

[RT #23572]
This commit is contained in:
Mark Andrews 2011-03-18 07:40:25 +00:00
parent b941939c0b
commit cbf59e5887
2 changed files with 77 additions and 2 deletions

View File

@ -1,3 +1,6 @@
3079. [bug] Handle isc_event_allocate failures in t_tasks.
[RT #23572]
3078. [func] Added a new include file with function typedefs
for the DLZ "dlopen" driver. [RT #23629]

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_tasks.c,v 1.45 2011/03/14 14:10:23 fdupont Exp $ */
/* $Id: t_tasks.c,v 1.46 2011/03/18 07:40:25 marka Exp $ */
#include <config.h>
@ -744,6 +744,14 @@ t_tasks3(void) {
*/
event = isc_event_allocate(mctx, &senders[1], event_type, t3_event1,
NULL, sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
(void) isc_mutex_unlock(&T3_mx);
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
return(T_UNRESOLVED);
}
isc_task_send(task, &event);
/*
@ -752,6 +760,14 @@ t_tasks3(void) {
for (cnt = 0; cnt < T3_NEVENTS; ++cnt) {
event = isc_event_allocate(mctx, &senders[1], event_type,
t3_event2, NULL, sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
(void) isc_mutex_unlock(&T3_mx);
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
return(T_UNRESOLVED);
}
isc_task_send(task, &event);
}
@ -963,6 +979,15 @@ t_tasks4(void) {
*/
event = isc_event_allocate(mctx, &senders[1], event_type, t4_event1,
NULL, sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
DESTROYLOCK(&T4_mx);
isc_task_destroy(&task);
(void) isc_condition_destroy(&T4_cv);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
return(T_UNRESOLVED);
}
isc_task_send(task, &event);
isc_task_shutdown(task);
@ -1171,6 +1196,15 @@ t_tasks7(void) {
event = isc_event_allocate(mctx, &senders[1], event_type, t7_event1,
NULL, sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
DESTROYLOCK(&T7_mx);
(void) isc_condition_destroy(&T7_cv);
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
return(T_UNRESOLVED);
}
isc_task_send(task, &event);
isc_task_shutdown(task);
@ -1495,6 +1529,16 @@ t_taskpurge_x(int sender, int type, int tag, void *purge_sender,
event = isc_event_allocate(mctx, (void *)1, (isc_eventtype_t)T_CONTROL,
t10_event1, NULL, sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
DESTROYLOCK(&T10_mx);
(void) isc_condition_destroy(&T10_cv);
++*nprobs;
return;
}
isc_task_send(task, &event);
/*
@ -1512,6 +1556,17 @@ t_taskpurge_x(int sender, int type, int tag, void *purge_sender,
(isc_eventtype_t)(type + type_cnt),
t10_event2, NULL, sizeof(*event));
if (eventtab[event_cnt] == NULL) {
t_info("isc_event_allocate failed\n");
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
DESTROYLOCK(&T10_mx);
(void) isc_condition_destroy(&T10_cv);
++*nprobs;
return;
}
eventtab[event_cnt]->ev_tag =
(void *)((uintptr_t)tag + tag_cnt);
@ -1883,11 +1938,28 @@ t_tasks11(int purgable) {
*/
event1 = isc_event_allocate(mctx, (void *)1, (isc_eventtype_t)1,
t11_event1, NULL, sizeof(*event1));
if (event1 == NULL) {
t_info("isc_event_allocate failed\n");
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
DESTROYLOCK(&T11_mx);
(void) isc_condition_destroy(&T11_cv);
return(T_UNRESOLVED);
}
isc_task_send(task, &event1);
event2 = isc_event_allocate(mctx, (void *)1, (isc_eventtype_t)1,
t11_event2, NULL, sizeof(*event2));
if (event2 == NULL) {
t_info("isc_event_allocate failed\n");
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
isc_mem_destroy(&mctx);
DESTROYLOCK(&T11_mx);
(void) isc_condition_destroy(&T11_cv);
return(T_UNRESOLVED);
}
event2_clone = event2;
if (purgable)
event2->ev_attributes &= ~ISC_EVENTATTR_NOPURGE;