I have problem with memory leaks
I have loop which read data on EXCEL with LibXL
library.
Book* book3 = xlCreateXMLBook();
if (book3->load("Výmera Územia, využitie pôdy.xlsx")) {
CellType cellType;
Sheet* sheet = book3->getSheet(0);
while (startIndex <= 100 * countOfLoad) {
int k = 1;
int numberOfBlank = 0;
const char* name = sheet->readStr(startIndex, 0);
nameOfVillage = name;
free ((void*) name);
...
}
...
}
const char* name = sheet->readStr(startIndex, 0);
- Reads a string and its format from cell.
Memory is allocated internally and valid until a new workbook is loaded or Book::release()
is called for binary implementation (xls).
But it's needed to copy a result string every time in xml implementation (xlsx).
BUT When I write free ((void*) name)
Give me Error:
Test(24919,0x1025bb380) malloc: *** error for object 0x10dacb738: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug
When my loop going after 158 time reading a string, This program stop reading cause memory is full, I must some delete memory after reading string.
Anyone can help? THX