7023416: (pack200) fix parfait issues
authorksrini
Fri, 11 Mar 2011 10:03:05 -0800
changeset 8779 d84abc7b455f
parent 8778 f2ef7d12277f
child 8780 c88e159a3e5c
7023416: (pack200) fix parfait issues Reviewed-by: jrose
jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp	Fri Mar 11 13:50:09 2011 +0000
+++ b/jdk/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 ;