From cfa0975ec50dcb81b2a3cbfc36eda9761b63d032 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 31 Aug 2019 23:20:07 +0000 Subject: mgdb: close process file descriptor upon detaching. --- overlay/mgdb/gdb/winnt-nat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/overlay/mgdb/gdb/winnt-nat.c b/overlay/mgdb/gdb/winnt-nat.c index 71d279b..cdfa210 100644 --- a/overlay/mgdb/gdb/winnt-nat.c +++ b/overlay/mgdb/gdb/winnt-nat.c @@ -158,12 +158,14 @@ static void winnt_attach (struct target_ops * t, const char * args, int from_tty if (__dbg_rbreak(pfd) < 0) { __dbg_detach(pfd); + close(pfd); winnt_perror ("could not issue a breakpoint in process",pid); } if (winnt_plist_add(pid,pfd) < 0) { __dbg_detach(pfd); + close(pfd); winnt_error ("could not expand debuggee list"); } } @@ -182,6 +184,9 @@ static void winnt_detach (struct target_ops * t, const char * args, int from_tty if (__dbg_detach(pfd) < 0) winnt_perror ("could not attach from process",pid); + if (close(pfd) < 0) + winnt_perror ("failed to close process file descriptor",pid); + winnt_plist_remove(pid); x86_cleanup_dregs(); -- cgit v1.2.3