vg_assert(is_valid_or_empty_tid(tid));
vg_assert(VG_(threads)[tid].status == VgTs_Empty);
+
/* Its stack is now off-limits */
- seg = VG_(find_segment)( VG_(threads)[tid].stack_base );
- VG_TRACK( die_mem_stack, seg->addr, seg->len );
+ if (VG_(threads)[tid].stack_base) {
+ seg = VG_(find_segment)( VG_(threads)[tid].stack_base );
+ VG_TRACK( die_mem_stack, seg->addr, seg->len );
+ }
VGA_(cleanup_thread)( &VG_(threads)[tid].arch );
VG_(threads)[tid].status = VgTs_Empty;
VG_(threads)[tid].associated_mx = NULL;
VG_(threads)[tid].associated_cv = NULL;
+ VG_(threads)[tid].stack_base = NULL;
+ VG_(threads)[tid].stack_size = 0;
cleanup_after_thread_exited( tid, True );
}
}