summaryrefslogtreecommitdiff
path: root/source/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/common.c')
-rw-r--r--source/common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/common.c b/source/common.c
index afe079f..0d632e9 100644
--- a/source/common.c
+++ b/source/common.c
@@ -505,6 +505,8 @@ typedef struct zhead_s {
static zhead_t z_chain;
+static cvar_t *z_perturb;
+
typedef struct zstatic_s {
zhead_t z;
char data[2]; /* !!make sure 'tail' field is aligned properly */
@@ -772,6 +774,11 @@ void *Z_TagMalloc( size_t size, memtag_t tag ) {
z_chain.next->prev = z;
z_chain.next = z;
+ if( z_perturb && z_perturb->integer ) {
+ memset( z + 1, z_perturb->integer, size -
+ sizeof( zhead_t ) - sizeof( uint16 ) );
+ }
+
*( uint16 * )( ( byte * )z + size - sizeof( uint16 ) ) = Z_TAIL;
s = &z_stats[tag < TAG_MAX ? tag : TAG_FREE];
@@ -1385,6 +1392,7 @@ void Qcommon_Init( char *commandLine ) {
//
// init commands and vars
//
+ z_perturb = Cvar_Get( "z_perturb", "0", 0 );
host_speeds = Cvar_Get ("host_speeds", "0", 0);
developer = Cvar_Get ("developer", "0", 0);
timescale = Cvar_Get ("timescale", "1", CVAR_CHEAT );