unqlite icon indicating copy to clipboard operation
unqlite copied to clipboard

unqlite: fix the memory leak about cell table

Open CV-Bowen opened this issue 1 year ago • 2 comments

Page cell table is alloced in lhInstallCell() when pPage->nCell < 1, but not free the cell table when pPage->nCell == 0.

So when in the next call of lhInstallCell() and pPage->nCell == 0, cell table is mallcoed again and old cell table not freed. Memory leak happends.

Memory Leak Backtrace:

malloc at nuttx/mm/umm_heap/umm_malloc.c:64
SyOSHeapAlloc atexternal/unqlite/unqlite/unqlite.c:26906
 (inlined by) MemOSAlloc at external/unqlite/unqlite/unqlite.c:27095
MemBackendAlloc at external/unqlite/unqlite/unqlite.c:27149
SyMemBackendAlloc at external/unqlite/unqlite/unqlite.c:27179
(discriminator 3) lhInstallCell at external/unqlite/unqlite/unqlite.c:49029
lhStoreCell at external/unqlite/unqlite/unqlite.c:50741
lhRecordInstall at external/unqlite/unqlite/unqlite.c:51065
 (inlined by) lh_record_insert at external/unqlite/unqlite/unqlite.c:51156
lh_record_insert at external/unqlite/unqlite/unqlite.c:51103
 (inlined by) lhash_kv_replace at external/unqlite/unqlite/unqlite.c:51184

CV-Bowen avatar Jan 04 '24 08:01 CV-Bowen

@symisc I found a memory leak problem. Could take a look? Thanks.

CV-Bowen avatar Jan 04 '24 08:01 CV-Bowen

@symisc Hi, Could you take a look at this memory leak issue?

CV-Bowen avatar Jul 22 '24 02:07 CV-Bowen