diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-02-21 05:14:06 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-02-21 05:14:06 +0000 |
commit | 38b3a2c089296350450e5dc0db2c279529fa6909 (patch) | |
tree | 568b4e927eb060baf6fa8db41e1f5ecccafb61c0 /libjava/boehm.cc | |
parent | 99740276e454972b57cca4b3b7a23dc1ec2690d5 (diff) | |
download | gcc-38b3a2c089296350450e5dc0db2c279529fa6909.zip gcc-38b3a2c089296350450e5dc0db2c279529fa6909.tar.gz gcc-38b3a2c089296350450e5dc0db2c279529fa6909.tar.bz2 |
* boehm.cc (_Jv_AllocBytes): Clear returned memory.
From-SVN: r32085
Diffstat (limited to 'libjava/boehm.cc')
-rw-r--r-- | libjava/boehm.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libjava/boehm.cc b/libjava/boehm.cc index 2c50c5c..ccfe9ee 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 |