Check for being properly setup before activating a thread. Fixes a potential although unlikely null-dereference.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent 6c6e6321fc
commit 3005297af2

@ -523,6 +523,14 @@ void *TmThreadsSlotVar(void *td) {
if (tv->thread_setup_flags != 0)
TmThreadSetupOptions(tv);
/* check if we are setup properly */
if (s == NULL || s->s == NULL || tv->tmqh_in == NULL || tv->tmqh_out == NULL) {
EngineKill();
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) -1);
}
for (slot = s->s; slot != NULL; slot = slot->slot_next) {
if (slot->SlotThreadInit != NULL) {
r = slot->SlotThreadInit(tv, slot->slot_initdata, &slot->slot_data);
@ -545,10 +553,8 @@ void *TmThreadsSlotVar(void *td) {
/* input a packet */
p = tv->tmqh_in(tv);
if (p == NULL) {
//printf("%s: TmThreadsSlotVar: p == NULL\n", tv->name);
} else {
if (p != NULL) {
/* run the thread module(s) */
r = TmThreadsSlotVarRun(tv, p, s->s);
if (r == TM_ECODE_FAILED) {
TmqhOutputPacketpool(tv, p);

Loading…
Cancel
Save