Avoid double free in startup_inferior

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.
This commit is contained in:
Kamil Rytarowski
2020-09-02 19:24:05 +02:00
parent 1ccb2c170c
commit f404573e4f
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2020-09-10 Kamil Rytarowski <n54@gmx.com>
* fork-inferior.c (startup_inferior): Avoid double free.
2020-09-10 Kamil Rytarowski <n54@gmx.com> 2020-09-10 Kamil Rytarowski <n54@gmx.com>
* netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add. * netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add.

View File

@ -526,7 +526,10 @@ startup_inferior (process_stratum_target *proc_target, pid_t pid, int ntraps,
case TARGET_WAITKIND_EXECD: case TARGET_WAITKIND_EXECD:
/* Handle EXEC signals as if they were SIGTRAP signals. */ /* 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; resume_signal = GDB_SIGNAL_TRAP;
switch_to_thread (proc_target, event_ptid); switch_to_thread (proc_target, event_ptid);
break; break;