ntdll: Make sure to not unmap anything from reserved areas
when using NtFreeVirtualMemory with the MEM_SYSTEM flag.
diff --git a/loader/kthread.c b/loader/kthread.c
index a012aad..577311b 100644
--- a/loader/kthread.c
+++ b/loader/kthread.c
@@ -190,8 +190,8 @@
/* copy the info structure since it is on the stack we will free */
struct wine_pthread_thread_info info = *(struct wine_pthread_thread_info *)ptr;
wine_ldt_free_fs( info.teb_sel );
- munmap( info.stack_base, info.stack_size );
- munmap( info.teb_base, info.teb_size );
+ if (info.stack_size) munmap( info.stack_base, info.stack_size );
+ if (info.teb_size) munmap( info.teb_base, info.teb_size );
#ifdef HAVE__LWP_CREATE
_lwp_exit();
#endif