]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* boehm.cc (_Jv_AllocBytes): Clear returned memory.
authorTom Tromey <tromey@cygnus.com>
Mon, 21 Feb 2000 05:14:06 +0000 (05:14 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Mon, 21 Feb 2000 05:14:06 +0000 (05:14 +0000)
From-SVN: r32085

libjava/ChangeLog
libjava/boehm.cc

index 7ff9c1c26fc6a8dc06100f291aa6135d87fe04f8..c767dfb6df9745d1313cd930107dabf1a073394f 100644 (file)
@@ -1,3 +1,7 @@
+2000-02-20  Tom Tromey  <tromey@cygnus.com>
+
+       * boehm.cc (_Jv_AllocBytes): Clear returned memory.
+
 2000-02-19  Bryce McKinlay  <bryce@albatross.co.nz>
 
        * java/util/zip/ZipEntry.java (setCrc): Fix overflow.
index 2c50c5cc0f09e7dba635ced5ccb6676b81f50a46..ccfe9ee16c4a6ef03972f8b575de9a9816d01091 100644 (file)
@@ -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