Do not free the last execd pathname as it will be used in
prepare_resume_reply(), after attaching a client side.
gdb/ChangeLog:
* fork-inferior.c (startup_inferior): Avoid double free.
+2020-09-10 Kamil Rytarowski <n54@gmx.com>
+
+ * fork-inferior.c (startup_inferior): Avoid double free.
+
2020-09-10 Kamil Rytarowski <n54@gmx.com>
* netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add.
case TARGET_WAITKIND_EXECD:
/* Handle EXEC signals as if they were SIGTRAP signals. */
- xfree (ws.value.execd_pathname);
+ /* Free the exec'ed pathname, but only if this isn't the
+ waitstatus we are returning to the caller. */
+ if (pending_execs != 1)
+ xfree (ws.value.execd_pathname);
resume_signal = GDB_SIGNAL_TRAP;
switch_to_thread (proc_target, event_ptid);
break;