The library should not assume anything about memory returned by the library. The library gives to wrapper pointer and size of allocated memory, and do not expect that wrapper will call to realloc or free. This is implementation details and can be changed in any time.
I don't agree that to fix it you have to bring more assumptions about how we keep tags in libcouchbase. This will only complicate things. I see that you use version detection macro in your patch, but this will not work. As the way how we allocate and manage memory in libcouchbase is not part of the public API and can be changed without version bump, and what you would do if the user, who've been using old version will just update libcouchbase shared object?