Probable small leak with a specfic order of actions
(1) By Max (Maxulite) on 2021-05-17 12:00:03 [source]
I have a minor memory leak with a specific order of actions, though I might miss something here. (Checked with version 3.35.5)
A virtual table implementation registers a user-defined function (doesn't matter before or after sqlite3_create_module_v2) with a sqlite3_create_function call. On xDestroy callback (when the db is being closed) it unregisters the function by calling sqlite3_create_function with xFunc parameter having NULL value. In this case my program detects a small leak (21-28 bytes), when there's no matching free for a malloc call. The program is in Delphi with sqlite static linking and malloc/free mapped to the Delphi rtl GetMem/FreeMem calls and detection was made by FastMM memory manager.
The conventional order of actions like registering and unregistering a function before the db is being closed or xDestroy is called doesn't produce the leak.
Also if I don't unregister the function (probably I can do this anyway, but currently it's irrelevant), there's also no leak.
(2) By Richard Hipp (drh) on 2021-05-17 13:13:48 in reply to 1 [link] [source]
Please try again using check-in 391c73132c80df94 or later and report back whether or not your problem has been resolved.
(3) By Max (Maxulite) on 2021-05-17 14:30:26 in reply to 2 [link] [source]
I see no leaks with this check-in. Thanks