Zdravim, pisu program za pouziti knihovny id3lib, ale narazil jsem na nejaky problem s pameti, ktery skonci SEGFAULTem... Prohnal jsem to valgrindem, ale ani to mne prilis nenasmerovalo spravnym smerem...
valgrind output:
==14716== Invalid read of size 4
==14716== at 0x404BEFC: ID3_Frame::GetField(ID3_FieldID) const (in /usr/lib/libid3-3.8.so.3.0.0)
==14716== by 0x8049BD0: Parse_mask(char const*, char const*, ID3_TagType) (in /home/earlcash/dev/id3fcp/id3fcp)
==14716== by 0x804967D: main (in /home/earlcash/dev/id3fcp/id3fcp)
==14716== Address 0x4 is not stack'd, malloc'd or (recently) free'd
==14716==
==14716== Process terminating with default action of signal 11 (SIGSEGV)
==14716== Access not within mapped region at address 0x4
==14716== at 0x404BEFC: ID3_Frame::GetField(ID3_FieldID) const (in /usr/lib/libid3-3.8.so.3.0.0)
==14716== by 0x8049BD0: Parse_mask(char const*, char const*, ID3_TagType) (in /home/earlcash/dev/id3fcp/id3fcp)
==14716== by 0x804967D: main (in /home/earlcash/dev/id3fcp/id3fcp)
==14716==
==14716== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 21 from 1)
==14716== malloc/free: in use at exit: 775 bytes in 6 blocks.
==14716== malloc/free: 16 allocs, 10 frees, 9,487 bytes allocated.
==14716== For counts of detected errors, rerun with: -v
==14716== searching for pointers to 6 not-freed blocks.
==14716== checked 130,888 bytes.
problemova cast funkce 'Parse_mask':
while(event[iter].symbol != NULL){
if((match = s_mask.find(event[iter].symbol)) != string::npos){
file.Find(event[iter].frame_id)->GetField(ID3FN_TEXT)->Get(tag_buff, 255);
s_mask.replace(match, strlen(event[iter].symbol), tag_buff);
iter++;
continue;
}
iter++;
}