mirror of
https://github.com/serge1/ELFIO.git
synced 2024-11-19 11:14:46 +00:00
fix alloc-dealloc-mismatch reported in ASAN
This commit is contained in:
parent
5468d90e06
commit
b996977925
@ -118,7 +118,7 @@ template <class T> class section_impl : public section
|
||||
void set_data( const char* raw_data, Elf_Word size ) override
|
||||
{
|
||||
if ( get_type() != SHT_NOBITS ) {
|
||||
data = std::unique_ptr<char>( new ( std::nothrow ) char[size] );
|
||||
data = std::unique_ptr<char[]>( new ( std::nothrow ) char[size] );
|
||||
if ( nullptr != data.get() && nullptr != raw_data ) {
|
||||
data_size = size;
|
||||
std::copy( raw_data, raw_data + size, data.get() );
|
||||
@ -149,7 +149,7 @@ template <class T> class section_impl : public section
|
||||
}
|
||||
else {
|
||||
data_size = 2 * ( data_size + size );
|
||||
std::unique_ptr<char> new_data(
|
||||
std::unique_ptr<char[]> new_data(
|
||||
new ( std::nothrow ) char[data_size] );
|
||||
|
||||
if ( nullptr != new_data ) {
|
||||
@ -270,7 +270,7 @@ template <class T> class section_impl : public section
|
||||
T header = { 0 };
|
||||
Elf_Half index = 0;
|
||||
std::string name;
|
||||
std::unique_ptr<char> data;
|
||||
std::unique_ptr<char[]> data;
|
||||
Elf_Word data_size = 0;
|
||||
const endianess_convertor* convertor = nullptr;
|
||||
const address_translator* translator = nullptr;
|
||||
|
@ -214,7 +214,7 @@ template <class T> class segment_impl : public segment
|
||||
private:
|
||||
T ph = { 0 };
|
||||
Elf_Half index = 0;
|
||||
std::unique_ptr<char> data;
|
||||
std::unique_ptr<char[]> data;
|
||||
std::vector<Elf_Half> sections;
|
||||
const endianess_convertor* convertor = nullptr;
|
||||
const address_translator* translator = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user