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>2011-11-29 19:34:49 +0400
committerChristopher Faylor <me@cgf.cx>2011-11-29 19:34:49 +0400
commit480b13a37aa1ca2e8ef6135a6d8dd9462c3df30e (patch)
treea612763e4e2bbc4d5298581ea617b73e8af693cd /winsup/cygwin/cygheap.cc
parentd1fc77322f7e413e2d717d006ffe0a55f913e2b2 (diff)
* sigproc.cc (remove_proc): Don't terminate the currently executing thread.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 554375943..fabb68072 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -70,18 +70,22 @@ cygheap_fixup_in_child (bool execed)
{
cygheap->hooks.next = NULL;
cygheap->user_heap.base = NULL; /* We can allocate the heap anywhere */
- /* Walk the allocated memory chain looking for orphaned memory from
- previous execs */
- for (_cmalloc_entry *rvc = cygheap->chain; rvc; rvc = rvc->prev)
- {
- cygheap_entry *ce = (cygheap_entry *) rvc->data;
- if (!rvc->ptr || rvc->b >= NBUCKETS || ce->type <= HEAP_1_START)
- continue;
- else if (ce->type < HEAP_1_MAX)
- ce->type += HEAP_1_MAX; /* Mark for freeing after next exec */
- else
- _cfree (ce); /* Marked by parent for freeing in child */
- }
+ }
+ /* Walk the allocated memory chain looking for orphaned memory from
+ previous execs or forks */
+ for (_cmalloc_entry *rvc = cygheap->chain; rvc; rvc = rvc->prev)
+ {
+ cygheap_entry *ce = (cygheap_entry *) rvc->data;
+ if (!rvc->ptr || rvc->b >= NBUCKETS || ce->type <= HEAP_1_START)
+ continue;
+ else if (ce->type > HEAP_2_MAX)
+ _cfree (ce); /* Marked for freeing in any child */
+ else if (!execed)
+ continue;
+ else if (ce->type > HEAP_1_MAX)
+ _cfree (ce); /* Marked for freeing in execed child */
+ else
+ ce->type += HEAP_1_MAX; /* Mark for freeing after next exec */
}
}