diff --git a/elfio/elfio_segment.hpp b/elfio/elfio_segment.hpp index 6b0f81d..9ebb24d 100644 --- a/elfio/elfio_segment.hpp +++ b/elfio/elfio_segment.hpp @@ -48,6 +48,7 @@ class segment ELFIO_GET_ACCESS_DECL( Elf64_Off, offset ); virtual const char* get_data() const = 0; + virtual void free_data() const = 0; virtual Elf_Half add_section( section* psec, Elf_Xword addr_align ) = 0; virtual Elf_Half add_section_index( Elf_Half index, @@ -104,6 +105,12 @@ template class segment_impl : public segment return data.get(); } + void free_data() const override + { + data.reset(nullptr); + is_lazy = true; + } + //------------------------------------------------------------------------------ Elf_Half add_section_index( Elf_Half sec_index, Elf_Xword addr_align ) override