This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Fix seg fault in fork_parent
- From: Arto Huusko <arto dot huusko at wmdata dot fi>
- To: cygwin-patches at cygwin dot com
- Date: Fri, 29 Jul 2005 13:24:48 +0300
- Subject: Fix seg fault in fork_parent
This patch fixes null deref in fork_parent() when pinfo::init fails.
I'm sorry the patch is not against CVS, but I am unable to use CVS from
where I work. If this is not acceptable, please tell me, and I can try
to do this from home.
In any case, the patch is against fork.cc rev 1.156.
2005-07-29 Arto Huusko <arto.huusko@wmdata.fi>
* fork.cc (fork_parent): Fix null deref if creation of pinfo
of the child fails.
--- fork.cc 2005-07-29 11:24:53.252749235 +0300
+++ fork.cc.fixed 2005-07-29 11:25:07.296216663 +0300
@@ -370,8 +370,6 @@ fork_parent (HANDLE&, dll *&first_dll, b
int child_pid = cygwin_pid (pi.dwProcessId);
pinfo child (child_pid, 1);
- child->start_time = time (NULL); /* Register child's starting time. */
- child->nice = myself->nice;
if (!child)
{
@@ -381,6 +379,9 @@ fork_parent (HANDLE&, dll *&first_dll, b
goto cleanup;
}
+ child->start_time = time (NULL); /* Register child's starting time. */
+ child->nice = myself->nice;
+
/* Initialize things that are done later in dll_crt0_1 that aren't done
for the forkee. */
strcpy (child->progname, myself->progname);