3Sep/0720
WTF: Random Memory Contents
If any of you out there are able to give me ONE GOOD REASON why anyone would do something like this, then please let me know. Below are "customised" realloc() and malloc() I recently stumbled across (yes, they get called. A LOT):
void *mcRealloc( void *P, int SIZE ) { int oldSize = _msize( P ); P = realloc( P, SIZE ); if ( P ) { for ( int i = oldSize; i < SIZE; i++ ) { ((char *) P)[i] = (char) rand(); } } return P; } void *mcMalloc( int SIZE ) { void *P; P = malloc( SIZE ); if ( P ) { for ( int i = 0; i < SIZE; i++ ) { ((char *) P)[i] = (char) rand(); } } return P; }
Is it just me, or is this a huge WTF?
-
http://www.vector-seven.com/ Tom
-
http://www.vector-seven.com Tom
-
IainB
-
IainB
-
http://buffered.io/ OJ
-
http://buffered.io/ OJ
-
http://my.opera.com/Vorlath/blog/ Vorlath
-
http://my.opera.com/Vorlath/blog/ Vorlath
-
http://buffered.io/ OJ
-
http://buffered.io/ OJ
-
http://my.opera.com/Vorlath/blog/ Vorlath
-
http://my.opera.com/Vorlath/blog/ Vorlath
-
http://www.vault-co.com/ Vault-Co
-
http://www.vault-co.com Vault-Co
-
http://buffered.io/ OJ
-
http://buffered.io/ OJ
-
Mark
-
Mark
-
http://buffered.io/ OJ
-
http://buffered.io/ OJ