src/share/vm/utilities/elfFile.cpp

changeset 2834
2a3da7eaf4a6
parent 2364
2d4762ec74af
child 3156
f08d439fab8c
     1.1 --- a/src/share/vm/utilities/elfFile.cpp	Tue Apr 12 14:18:53 2011 -0700
     1.2 +++ b/src/share/vm/utilities/elfFile.cpp	Wed Apr 27 09:09:57 2011 -0400
     1.3 @@ -29,6 +29,7 @@
     1.4  #include <string.h>
     1.5  #include <stdio.h>
     1.6  #include <limits.h>
     1.7 +#include <new>
     1.8  
     1.9  #include "memory/allocation.inline.hpp"
    1.10  #include "utilities/decoder.hpp"
    1.11 @@ -46,7 +47,7 @@
    1.12    m_status = Decoder::no_error;
    1.13  
    1.14    int len = strlen(filepath) + 1;
    1.15 -  m_filepath = NEW_C_HEAP_ARRAY(char, len);
    1.16 +  m_filepath = (const char*)os::malloc(len * sizeof(char));
    1.17    if (m_filepath != NULL) {
    1.18      strcpy((char*)m_filepath, filepath);
    1.19      m_file = fopen(filepath, "r");
    1.20 @@ -74,7 +75,7 @@
    1.21    }
    1.22  
    1.23    if (m_filepath != NULL) {
    1.24 -    FREE_C_HEAP_ARRAY(char, m_filepath);
    1.25 +    os::free((void*)m_filepath);
    1.26    }
    1.27  
    1.28    if (m_next != NULL) {
    1.29 @@ -120,14 +121,14 @@
    1.30        }
    1.31        // string table
    1.32        if (shdr.sh_type == SHT_STRTAB) {
    1.33 -        ElfStringTable* table = new ElfStringTable(m_file, shdr, index);
    1.34 +        ElfStringTable* table = new (std::nothrow) ElfStringTable(m_file, shdr, index);
    1.35          if (table == NULL) {
    1.36            m_status = Decoder::out_of_memory;
    1.37            return false;
    1.38          }
    1.39          add_string_table(table);
    1.40        } else if (shdr.sh_type == SHT_SYMTAB || shdr.sh_type == SHT_DYNSYM) {
    1.41 -        ElfSymbolTable* table = new ElfSymbolTable(m_file, shdr);
    1.42 +        ElfSymbolTable* table = new (std::nothrow) ElfSymbolTable(m_file, shdr);
    1.43          if (table == NULL) {
    1.44            m_status = Decoder::out_of_memory;
    1.45            return false;

mercurial