* external.cc (fillout_pinfo): Return NULL rather than 0.

(exit_process): Guard against NULL pointer dereference found by Clang.
This commit is contained in:
Christopher Faylor 2012-07-02 19:48:33 +00:00
parent e14a5a7efa
commit fb348d22af
2 changed files with 12 additions and 5 deletions

View File

@ -1,12 +1,17 @@
2012-07-02 Christopher Faylor <me.cygwin2012@cgf.cx>
* external.cc (fillout_pinfo): Return NULL rather than 0.
(exit_process): Guard against NULL pointer dereference found by Clang.
2012-07-02 Christopher Faylor <me.cygwin2012@cgf.cx> 2012-07-02 Christopher Faylor <me.cygwin2012@cgf.cx>
* mount.cc (mount_info::conv_to_win32_path): Eliminate unneeded * mount.cc (mount_info::conv_to_win32_path): Eliminate unneeded
assignment found by CLANG. assignment found by Clang.
2012-07-02 Christopher Faylor <me.cygwin2012@cgf.cx> 2012-07-02 Christopher Faylor <me.cygwin2012@cgf.cx>
* path.cc (symlink_info::check): Remove unneeded/unused variable found * path.cc (symlink_info::check): Remove unneeded/unused variable found
by CLANG. by Clang.
2012-07-02 Corinna Vinschen <corinna@vinschen.de> 2012-07-02 Corinna Vinschen <corinna@vinschen.de>

View File

@ -108,7 +108,7 @@ fillout_pinfo (pid_t pid, int winpid)
{ {
i = 0; i = 0;
pids.reset (); pids.reset ();
return 0; return NULL;
} }
return &ep; return &ep;
} }
@ -189,7 +189,9 @@ exit_process (UINT status, bool useTerminateProcess)
external_pinfo *ep = fillout_pinfo (pid, 1); external_pinfo *ep = fillout_pinfo (pid, 1);
DWORD dwpid = ep ? ep->dwProcessId : pid; DWORD dwpid = ep ? ep->dwProcessId : pid;
pinfo p (pid, PID_MAP_RW); 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); p.set_exit_code ((DWORD)status);
if (useTerminateProcess) if (useTerminateProcess)
TerminateProcess (GetCurrentProcess(), status); TerminateProcess (GetCurrentProcess(), status);