From: Mark Mitchell Date: Mon, 20 Mar 2006 04:05:24 +0000 (+0000) Subject: * gdb/ser-mingw.c (free_pipe_state): Close pipe before calling X-Git-Tag: gdb-csl-20060226-branch-merge-to-csl-local-1~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc5326d2c5719a1542002b610e75960cb8fe7656;p=thirdparty%2Fbinutils-gdb.git * gdb/ser-mingw.c (free_pipe_state): Close pipe before calling pex_free. --- diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c index 5d0c0733b57..b5cd16eb26c 100644 --- a/gdb/ser-mingw.c +++ b/gdb/ser-mingw.c @@ -616,10 +616,13 @@ free_pipe_state (struct pipe_state *ps) if (ps->wait.stop_select != INVALID_HANDLE_VALUE) SetEvent (ps->wait.stop_select); - if (ps->pex) - pex_free (ps->pex); + /* Close the pipe to the child. We must close the pipe before + calling pex_free because pex_free will wait for the child to exit + and the child will not exit until the pipe is closed. */ if (ps->input) fclose (ps->input); + if (ps->pex) + pex_free (ps->pex); /* pex_free closes ps->output. */ xfree (ps);