When using the C++ database class, I notice that it returns invalid data. I think that it is returning data after free since I have the following snippet:
Which outputs 2 (aka kFLNumber) instead of the correct 5 (kFLArray)
The implementation of getIndexNames() is currently
I don't see anywhere that fleece::Array will retain the result, so it looks like it releases the memory before returning it. Removing the release call here will cause the correct output, however the object is leaked of course.
Activity
Show:
CB robot December 11, 2021 at 12:06 AM
Build couchbase-lite-c-3.1.0-60 contains couchbase-lite-c commit dba6385 with commit message: : Change Database::getIndexNames() to return RetainedArray
As this issue only happens in C++ API which is not part of the Lithium release, I'm switching the issue to helium.
Pasin Suriyentrakorn December 1, 2021 at 3:27 AM
From reading the code, as commented, fleece:Array, fleece:Dict, and fleece:Value don't seem to retain the inner value unless there are some hidden tricks. Will do some testing and confirm.
Jay Vavachan November 18, 2021 at 12:18 AM
wrong issue number, and not a fix but workaround to make build pass caused it to automatically transition. Reopening...
Fixed
Pinned fields
Click on the next to a field label to start pinning.
When using the C++
database
class, I notice that it returns invalid data. I think that it is returning data after free since I have the following snippet:Which outputs 2 (aka
kFLNumber
) instead of the correct 5 (kFLArray
)The implementation of
getIndexNames()
is currentlyI don't see anywhere that
fleece::Array
will retain the result, so it looks like it releases the memory before returning it. Removing the release call here will cause the correct output, however the object is leaked of course.