changeset 3917:ed87479c96c2

7023416: (pack200) fix parfait issues Reviewed-by: jrose
author ksrini
date Fri, 11 Mar 2011 10:03:05 -0800
parents 3fdfa11ea5ac
children 8216ad5fabb8
files src/share/native/com/sun/java/util/jar/pack/unpack.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/com/sun/java/util/jar/pack/unpack.cpp	Fri Mar 11 13:50:09 2011 +0000
+++ b/src/share/native/com/sun/java/util/jar/pack/unpack.cpp	Fri Mar 11 10:03:05 2011 -0800
@@ -489,7 +489,6 @@
 
 // Call malloc.  Try to combine small blocks and free much later.
 void* unpacker::alloc_heap(size_t size, bool smallOK, bool temp) {
-  CHECK_0;
   if (!smallOK || size > SMALL) {
     void* res = must_malloc((int)size);
     (temp ? &tmallocs : &mallocs)->add(res);
@@ -2560,6 +2559,10 @@
   int i;
   int prevBII = -1;
   int prevBCI = -1;
+  if (body == NULL) {
+    abort("putlayout: unexpected NULL for body");
+    return;
+  }
   for (i = 0; body[i] != null; i++) {
     band& b = *body[i];
     byte le_kind = b.le_kind;
@@ -4767,7 +4770,9 @@
     }
 
     char *tname = tempnam(tmpdir,"#upkg");
+    if (tname == NULL) return;
     sprintf(log_file_name, "%s", tname);
+    ::free(tname);
     if ((errstrm = fopen(log_file_name, "a+")) != NULL) {
       log_file = errstrm_name = saveStr(log_file_name);
       return ;