List:Internals« Previous MessageNext Message »
From:serg Date:August 24 2005 9:07pm
Subject:bk commit into 4.1 tree (serg:1.2390)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of serg. When serg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2390 05/08/24 23:07:06 serg@stripped +1 -0
  memroot: trash the memory in free_root()

  mysys/my_alloc.c
    1.25 05/08/24 23:07:01 serg@stripped +14 -1
    memroot: trash the memory in free_root()

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	serg
# Host:	sergbook.mysql.com
# Root:	/usr/home/serg/Abk/mysql-4.1

--- 1.24/mysys/my_alloc.c	Tue Oct 26 20:29:54 2004
+++ 1.25/mysys/my_alloc.c	Wed Aug 24 23:07:01 2005
@@ -203,7 +203,7 @@
     next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
     *prev=next;
   }
-    
+
   point= (gptr) ((char*) next+ (next->size-next->left));
   /*TODO: next part may be unneded due to mem_root->first_block_usage counter*/
   if ((next->left-= Size) < mem_root->min_malloc)
@@ -217,6 +217,12 @@
 #endif
 }
 
+#ifdef SAFEMALLOC
+#define TRASH(X) bfill(((char*)(X) + ((X)->size-(X)->left)), (X)->left, 0xa5)
+#else
+#define TRASH /* no-op */
+#endif
+
 /* Mark all data in blocks free for reusage */
 
 static inline void mark_blocks_free(MEM_ROOT* root)
@@ -227,14 +233,20 @@
   /* iterate through (partially) free blocks, mark them free */
   last= &root->free;
   for (next= root->free; next; next= *(last= &next->next))
+  {
     next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM));
+    TRASH(next);
+  }
 
   /* Combine the free and the used list */
   *last= next=root->used;
 
   /* now go through the used blocks and mark them free */
   for (; next; next= next->next)
+  {
     next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM));
+    TRASH(next);
+  }
 
   /* Now everything is set; Indicate that nothing is used anymore */
   root->used= 0;
@@ -280,6 +292,7 @@
   {
     root->free=root->pre_alloc;
     root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM));
+    TRASH(root->pre_alloc);
     root->free->next=0;
   }
   root->block_num= 4;
Thread
bk commit into 4.1 tree (serg:1.2390)serg24 Aug