* boehm.cc (_Jv_AllocBytes): Clear returned memory.

From-SVN: r32085
This commit is contained in:
Tom Tromey 2000-02-21 05:14:06 +00:00 committed by Tom Tromey
parent 99740276e4
commit 38b3a2c089
2 changed files with 12 additions and 1 deletions

View 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.

View 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