On 11/25/2017 02:57 AM, Stephen F. Booth wrote:
I have been working on a custom FTS5 tokenizer using SQLite 3.21.0. I
noticed that in fts5CreateTokenizer() if the call to sqlite3_malloc() fails
SQLITE_NOMEM is returned, however xDestroy (if present) is not called. A
similar situation is handled differently in sqlite3_bind_pointer(); in that
function, xDestructor is called on failure. In case of a failure in
fts5CreateTokenizer() is it the caller's responsibility to invoke
xDestroy() or should this be handled by SQLite?
Ideally, it would have been handled by SQLite. But the API has been
released now, so I think we'll just document that xCreateFunction() and
xCreateTokenizer() do *not* invoke the xDestroy() if they fail. The
application has to clean up its own objects in this case. This happened
with sqlite3_create_collation_v2() as well.
sqlite-users mailing list