summaryrefslogtreecommitdiff
path: root/libjava/boehm.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-21 05:14:06 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-21 05:14:06 +0000
commit9a069e71d21fdcc5f0bb618c28257b9ff7d9cbe7 (patch)
tree568b4e927eb060baf6fa8db41e1f5ecccafb61c0 /libjava/boehm.cc
parentce96ab9966388b027221e851b542062ec3f4088e (diff)
downloadgcc-9a069e71d21fdcc5f0bb618c28257b9ff7d9cbe7.tar.gz
* boehm.cc (_Jv_AllocBytes): Clear returned memory.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32085 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/boehm.cc')
-rw-r--r--libjava/boehm.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/libjava/boehm.cc b/libjava/boehm.cc
index 2c50c5cc0f0..ccfe9ee16c4 100644
--- a/libjava/boehm.cc
+++ b/libjava/boehm.cc
@@ -321,7 +321,14 @@ _Jv_AllocArray (jsize size)
void *
_Jv_AllocBytes (jsize size)
{
- return GC_GENERIC_MALLOC (size, PTRFREE);
+ void *r = GC_GENERIC_MALLOC (size, PTRFREE);
+ // We have to explicitly zero memory here, as the GC doesn't
+ // guarantee that PTRFREE allocations are zeroed. Note that we
+ // don't have to do this for other allocation types because we set
+ // the `ok_init' flag in the type descriptor.
+ if (r != NULL)
+ memset (r, 0, size);
+ return r;
}
static void