Skip to content

Got a "double free or corruption" when destroy a deserialized SuRF in BitvectorRank #11

@iele

Description

@iele

Test Code:

#include
#include
#include "include/surf.hpp"
using namespace surf;
int main() {
std::vectorstd::string keys = {
"f",
"far",
"fast",
"s",
"top",
"toy",
"trie",
};
// basic surf
SuRF* surf = new SuRF(keys);
surf = SuRF::deSerialize(surf->serialize());
std::cout << "destory surf" << std::endl;
surf->destroy();
return 0;
}

Got a core dumped
image

Maybe the issue happens when destroy BitVectorRank:

void destroy()
{
delete[] bits_;
delete[] rank_lut_;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions