brechtsanders / xlsxio

XLSX I/O - C library for reading and writing .xlsx files
MIT License
417 stars 112 forks source link

Is that a memory leak? #54

Closed dgrr closed 4 years ago

dgrr commented 4 years ago

Hello,

I think this part of the code is affected by a memory leak. In the pointed functions, you're using result but you're not freeing it. I don't know completely if that's a memory leak, but as I see how xlsxioread_sheet_next_cell works, I think it is. Correct me if I am wrong.

Thanks.

brechtsanders commented 4 years ago

Hi, XLSXIOCHAR* xlsxioread_sheet_next_cell (xlsxioreadersheet sheethandle) returns a string which the caller needs to call free() on, so the function does exit without releasing that memory. But it's up to the caller to release it to prevent memory leaks in this case. So I did notice that xlsxioread_sheet_next_cell_int/xlsxioread_sheet_next_cell_float/xlsxioread_sheet_next_cell_datetime didn't call free(result); I have added it now in master. Thanks for spotting this. Brecht

brechtsanders commented 4 years ago

Fixed in release 0.2.25