@@ -776,18 +776,21 void ElfFile::updateSections() | |||||
776 |
|
776 | |||
777 | void ElfFile::updateSegments() |
|
777 | void ElfFile::updateSegments() | |
778 | { |
|
778 | { | |
779 | elf_getphdrnum (this->e , &this->SegmentCount); |
|
|||
780 | for(int i=0;i<this->Segments.count();i++) |
|
779 | for(int i=0;i<this->Segments.count();i++) | |
781 | { |
|
780 | { | |
782 | free(this->Segments.at(i)); |
|
781 | free(this->Segments.at(i)); | |
783 | } |
|
782 | } | |
784 | this->Segments.clear(); |
|
783 | this->Segments.clear(); | |
785 |
|
|
784 | this->SegmentCount = 0; | |
786 | { |
|
|||
787 |
|
|
785 | GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); | |
788 |
gelf_getphdr |
|
786 | while ( header == gelf_getphdr(this->e ,this->SegmentCount, header )) | |
|
787 | { | |||
789 | this->Segments.append(header); |
|
788 | this->Segments.append(header); | |
|
789 | this->SegmentCount++; | |||
|
790 | header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); | |||
790 | } |
|
791 | } | |
|
792 | this->SegmentCount = this->Segments.count(); | |||
|
793 | free(header); | |||
791 | } |
|
794 | } | |
792 |
|
795 | |||
793 | void ElfFile::updateSymbols() |
|
796 | void ElfFile::updateSymbols() |
@@ -433,18 +433,21 void elfparser::updateSections() | |||||
433 |
|
433 | |||
434 | void elfparser::updateSegments() |
|
434 | void elfparser::updateSegments() | |
435 | { |
|
435 | { | |
436 | elf_getphdrnum (this->e , &this->SegmentCount); |
|
|||
437 | for(int i=0;i<this->Segments.count();i++) |
|
436 | for(int i=0;i<this->Segments.count();i++) | |
438 | { |
|
437 | { | |
439 | free(this->Segments.at(i)); |
|
438 | free(this->Segments.at(i)); | |
440 | } |
|
439 | } | |
441 | this->Segments.clear(); |
|
440 | this->Segments.clear(); | |
442 |
|
|
441 | this->SegmentCount = 0; | |
443 | { |
|
|||
444 |
|
|
442 | GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); | |
445 |
gelf_getphdr |
|
443 | while ( header == gelf_getphdr(this->e ,this->SegmentCount, header )) | |
|
444 | { | |||
446 | this->Segments.append(header); |
|
445 | this->Segments.append(header); | |
|
446 | this->SegmentCount++; | |||
|
447 | header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); | |||
447 | } |
|
448 | } | |
|
449 | this->SegmentCount = this->Segments.count(); | |||
|
450 | free(header); | |||
448 | } |
|
451 | } | |
449 |
|
452 | |||
450 |
|
453 |
General Comments 0
You need to be logged in to leave comments.
Login now