385abae
Description: <short summary of the patch>
385abae
 TODO: Put a short summary on the line above and replace this paragraph
385abae
 with a longer explanation of this change. Complete the meta-information
385abae
 with other relevant fields (see below for details). To make it easier, the
385abae
 information below has been extracted from the changelog. Adjust it or drop
385abae
 it.
385abae
 .
385abae
 gcl (2.6.12-2) unstable; urgency=medium
385abae
 .
385abae
   * Version_2_6_13pre1
385abae
Author: Camm Maguire <camm@debian.org>
385abae
385abae
---
385abae
The information above should follow the Patch Tagging Guidelines, please
385abae
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
385abae
are templates for supplementary fields that you might want to add:
385abae
385abae
Origin: <vendor|upstream|other>, <url of original patch>
385abae
Bug: <url in upstream bugtracker>
385abae
Bug-Debian: https://bugs.debian.org/<bugnumber>
385abae
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
385abae
Forwarded: <no|not-needed|url proving that it has been forwarded>
385abae
Reviewed-By: <name and email of someone who approved the patch>
385abae
Last-Update: <YYYY-MM-DD>
385abae
385abae
--- gcl-2.6.12.orig/o/alloc.c
385abae
+++ gcl-2.6.12/o/alloc.c
385abae
@@ -1269,10 +1269,11 @@ gcl_init_alloc(void *cs_start) {
385abae
   update_real_maxpage();
385abae
 
385abae
   if (gcl_alloc_initialized) {
385abae
-    massert(rb_start==heap_end &&rb_end==heap_end && rb_limit==heap_end && rb_pointer==heap_end);
385abae
-    holepage=new_holepage;
385abae
-    alloc_page(-holepage);
385abae
-    rb_start=rb_end=rb_limit=rb_pointer=heap_end+(holepage<
385abae
+    if (rb_start==heap_end && rb_end==rb_start && rb_limit==rb_start && rb_pointer==rb_start) {
385abae
+      holepage=new_holepage;
385abae
+      alloc_page(-holepage);
385abae
+      rb_start=rb_end=rb_limit=rb_pointer=heap_end+(holepage<
385abae
+    }
385abae
     return;
385abae
   }
385abae
   
385abae
@@ -1814,25 +1815,19 @@ void
385abae
 free(void *ptr) {
385abae
 
385abae
   object *p,pp;
385abae
+  static void *initial_monstartup_pointer_echo;
385abae
   
385abae
   if (ptr == 0)
385abae
     return;
385abae
   
385abae
   for (p = &malloc_list,pp=*p; pp && !endp(pp);  p = &((pp)->c.c_cdr),pp=pp->c.c_cdr)
385abae
     if ((pp)->c.c_car->st.st_self == ptr) {
385abae
-      /* SGC contblock pages: Its possible this is on an old page CM 20030827 */
385abae
-/* #ifdef SGC */
385abae
-/*       insert_maybe_sgc_contblock((pp)->c.c_car->st.st_self,(pp)->c.c_car->st.st_dim); */
385abae
-/* #else */
385abae
-/*       insert_contblock((pp)->c.c_car->st.st_self,(pp)->c.c_car->st.st_dim); */
385abae
-/* #endif */
385abae
       (pp)->c.c_car->st.st_self = NULL;
385abae
       *p = pp->c.c_cdr;
385abae
 #ifdef GCL_GPROF
385abae
       if (initial_monstartup_pointer==ptr) {
385abae
+	initial_monstartup_pointer_echo=ptr;
385abae
 	initial_monstartup_pointer=NULL;
385abae
-	if (core_end-heap_end>=sizeof(ptr))
385abae
-	  *(void **)heap_end=ptr;
385abae
       }
385abae
 #endif
385abae
       return;
385abae
@@ -1840,12 +1835,13 @@ free(void *ptr) {
385abae
 #ifdef NOFREE_ERR
385abae
   return;
385abae
 #else	
385abae
-  if (core_end-heap_end
385abae
+  if (ptr!=initial_monstartup_pointer_echo) {
385abae
     static void *old_ptr;
385abae
     if (old_ptr==ptr) return;
385abae
     old_ptr=ptr;
385abae
     FEerror("free(3) error.",0);
385abae
   }
385abae
+  initial_monstartup_pointer_echo=NULL;
385abae
   return;
385abae
 #endif	
385abae
 }