aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/boehm.cc9
2 files changed, 12 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 7ff9c1c..c767dfb 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -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.
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