Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-07-02 23:48:33 +0400
committerChristopher Faylor <me@cgf.cx>2012-07-02 23:48:33 +0400
commitfb348d22afc85a2dfba80c3059391e8bc276e9ca (patch)
tree642176d17432f02e8a1110e7d7d7daeb7d9984f9 /winsup/cygwin/external.cc
parente14a5a7efa4350fd75a0c8db65461d8d12a13b17 (diff)
* external.cc (fillout_pinfo): Return NULL rather than 0.
(exit_process): Guard against NULL pointer dereference found by Clang.
Diffstat (limited to 'winsup/cygwin/external.cc')
-rw-r--r--winsup/cygwin/external.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index cd86966b8..22636aa53 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -108,7 +108,7 @@ fillout_pinfo (pid_t pid, int winpid)
{
i = 0;
pids.reset ();
- return 0;
+ return NULL;
}
return &ep;
}
@@ -186,10 +186,12 @@ static void
exit_process (UINT status, bool useTerminateProcess)
{
pid_t pid = getpid ();
- external_pinfo * ep = fillout_pinfo (pid, 1);
+ external_pinfo *ep = fillout_pinfo (pid, 1);
DWORD dwpid = ep ? ep->dwProcessId : pid;
pinfo p (pid, PID_MAP_RW);
- if ((dwpid == GetCurrentProcessId()) && (p->pid == ep->pid))
+ if (ep)
+ pid = ep->pid;
+ if ((dwpid == GetCurrentProcessId()) && (p->pid == pid))
p.set_exit_code ((DWORD)status);
if (useTerminateProcess)
TerminateProcess (GetCurrentProcess(), status);