unqlite: fix the memory leak about cell table#164
Open
CV-Bowen wants to merge 1 commit intosymisc:masterfrom
Open
unqlite: fix the memory leak about cell table#164CV-Bowen wants to merge 1 commit intosymisc:masterfrom
CV-Bowen wants to merge 1 commit intosymisc:masterfrom
Conversation
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 /data/project/n62/rel-4.0/nuttx/mm/umm_heap/umm_malloc.c:64 SyOSHeapAlloc at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:26906 (inlined by) MemOSAlloc at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:27095 MemBackendAlloc at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:27149 SyMemBackendAlloc at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:27179 (discriminator 3) lhInstallCell at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:49029 lhStoreCell at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:50741 lhRecordInstall at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:51065 (inlined by) lh_record_insert at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:51156 lh_record_insert at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:51103 (inlined by) lhash_kv_replace at /data/project/n62/rel-4.0/external/unqlite/unqlite/unqlite.c:51184 Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Contributor
Author
|
@symisc I found a memory leak problem. Could take a look? Thanks. |
Contributor
Author
|
@symisc Hi, Could you take a look at this memory leak issue? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: