|
@@ -517,6 +517,10 @@ void * realloc ( void *old_ptr, size_t new_size ) {
|
517
|
517
|
VALGRIND_FREELIKE_BLOCK ( old_ptr, 0 );
|
518
|
518
|
}
|
519
|
519
|
|
|
520
|
+ if ( ASSERTED ) {
|
|
521
|
+ DBGC ( &heap, "Possible memory corruption detected from %p\n",
|
|
522
|
+ __builtin_return_address ( 0 ) );
|
|
523
|
+ }
|
520
|
524
|
return new_ptr;
|
521
|
525
|
}
|
522
|
526
|
|
|
@@ -530,7 +534,14 @@ void * realloc ( void *old_ptr, size_t new_size ) {
|
530
|
534
|
* will be aligned to at least a multiple of sizeof(void*).
|
531
|
535
|
*/
|
532
|
536
|
void * malloc ( size_t size ) {
|
533
|
|
- return realloc ( NULL, size );
|
|
537
|
+ void *ptr;
|
|
538
|
+
|
|
539
|
+ ptr = realloc ( NULL, size );
|
|
540
|
+ if ( ASSERTED ) {
|
|
541
|
+ DBGC ( &heap, "Possible memory corruption detected from %p\n",
|
|
542
|
+ __builtin_return_address ( 0 ) );
|
|
543
|
+ }
|
|
544
|
+ return ptr;
|
534
|
545
|
}
|
535
|
546
|
|
536
|
547
|
/**
|
|
@@ -544,7 +555,12 @@ void * malloc ( size_t size ) {
|
544
|
555
|
* If @c ptr is NULL, no action is taken.
|
545
|
556
|
*/
|
546
|
557
|
void free ( void *ptr ) {
|
|
558
|
+
|
547
|
559
|
realloc ( ptr, 0 );
|
|
560
|
+ if ( ASSERTED ) {
|
|
561
|
+ DBGC ( &heap, "Possible memory corruption detected from %p\n",
|
|
562
|
+ __builtin_return_address ( 0 ) );
|
|
563
|
+ }
|
548
|
564
|
}
|
549
|
565
|
|
550
|
566
|
/**
|
|
@@ -564,6 +580,10 @@ void * zalloc ( size_t size ) {
|
564
|
580
|
data = malloc ( size );
|
565
|
581
|
if ( data )
|
566
|
582
|
memset ( data, 0, size );
|
|
583
|
+ if ( ASSERTED ) {
|
|
584
|
+ DBGC ( &heap, "Possible memory corruption detected from %p\n",
|
|
585
|
+ __builtin_return_address ( 0 ) );
|
|
586
|
+ }
|
567
|
587
|
return data;
|
568
|
588
|
}
|
569
|
589
|
|