At the end of linux_nat_detach the main_lwp is deleted (delete_lwp).
This is problematic as during detach (detach_one_lwp and
linux_fork_detach) main_lwp already gets freed.  Thus calling
delete_lwp causes a read after free.  Fix it by removing the
unnecessary delete_lwp.
gdb/ChangeLog:
2017-04-11  Philipp Rudo  <prudo@linux.vnet.ibm.com>
	* linux-nat.c (linux_nat_detach): Remove delete_lwp call.
+2017-04-11  Philipp Rudo  <prudo@linux.vnet.ibm.com>
+
+       * linux-nat.c (linux_nat_detach): Remove delete_lwp call.
+
 2017-04-11  Alan Hayward  <alan.hayward@arm.com>
 
        * arm-tdep.c (arm_store_return_value): Use FP_REGISTER_SIZE
 
 
       inf_ptrace_detach_success (ops);
     }
-  delete_lwp (main_lwp->ptid);
 }
 
 /* Resume execution of the inferior process.  If STEP is nonzero,