linux-lts-quantal-3.5.0/kernel/replay.c
// Intended to check for double frees
Intended to check for double frees
Intended to check for double frees
void* KMALLOC(size_t size, gfp_t flags)
{
	void* ptr;
	int i;
	mutex_lock (&repmalloc_mutex);
	if (!malloc_init) {
		malloc_init = 1;
		for (i = 0; i < 1023; i++) {
			malloc_hash[i] = ds_list_create (NULL, 0, 0);
		}
	}
	ptr = kmalloc (size, flags);
	if (ptr) {
		u_long addr = (u_long) ptr;
		ds_list_insert (malloc_hash[addr%1023], ptr);
	}
	mutex_unlock (&repmalloc_mutex);
	return ptr;
}
void * KMALLOC ( size_t size , gfp_t flags ) { void * ptr ; int i ; mutex_lock ( & repmalloc_mutex ) ; if ( ! malloc_init ) { malloc_init = 1 ; for ( i = 0 ; i < 1023 ; i ++ ) { malloc_hash [ i ] = ds_list_create ( NULL , 0 , 0 ) ; } } ptr = kmalloc ( size , flags ) ; if ( ptr ) { u_long addr = ( u_long ) ptr ; ds_list_insert ( malloc_hash [ addr % 1023 ] , ptr ) ; } mutex_unlock ( & repmalloc_mutex ) ; return ptr ; }
Intended to check for double frees
Intended to check for double frees