summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libc/malloc.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-04-22 16:50:17 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-04-22 16:50:17 +0000
commit1f94ed6bfdb8b83fcfcb59db0a9f76eb950b4db0 (patch)
tree441f57ebc555db3a382bac7e8dedd51ba55ab3e4 /c/src/lib/libc/malloc.c
parentUpdates from Tony Bennett. rtems_environp removed among other minor things. (diff)
downloadrtems-1f94ed6bfdb8b83fcfcb59db0a9f76eb950b4db0.tar.bz2
Updates from Tony Bennett.
Diffstat (limited to 'c/src/lib/libc/malloc.c')
-rw-r--r--c/src/lib/libc/malloc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/c/src/lib/libc/malloc.c b/c/src/lib/libc/malloc.c
index ed053d6e8d..de63df6ea0 100644
--- a/c/src/lib/libc/malloc.c
+++ b/c/src/lib/libc/malloc.c
@@ -25,12 +25,14 @@
#include <assert.h>
#include <errno.h>
#include <string.h>
+#include <unistd.h> /* sbrk(2) */
rtems_id RTEMS_Malloc_Heap;
size_t RTEMS_Malloc_Sbrk_amount;
#ifdef RTEMS_DEBUG
#define MALLOC_STATS
+#define MALLOC_DIRTY
#endif
#ifdef MALLOC_STATS
@@ -202,7 +204,11 @@ void *malloc(
malloc_stats.max_depth = current_depth;
}
#endif
-
+
+#ifdef MALLOC_DIRTY
+ (void) memset(return_this, 0xCF, size);
+#endif
+
return return_this;
}
@@ -221,6 +227,8 @@ void *calloc(
if ( cptr )
memset( cptr, '\0', length );
+ MSBUMP(malloc_calls, -1); /* subtract off the malloc */
+
return cptr;
}