Skip to content

Double free? #4

Open
Open
@ignatz

Description

@ignatz

Hi Alex, really cool stuff you're doing with sqlite 👏

I had a brief look at this crates and saw a bunch of TODOs, i.e.:

https://github.com/asg017/sqlite-jsonschema/blob/main/src/jsonschema.rs#L74
https://github.com/asg017/sqlite-loadable-rs/blob/2c5c049c0c9e010a70b458fde459facf294befce/src/api.rs#L390

and they surprised me.

AFAICT based on https://sqlite.org/c3ref/get_auxdata.html, you pass sqlite the data and a cleanup function, i.e. sqlite manages that memory.

In other words, there shouldn't be a leak but maybe worse, https://github.com/asg017/sqlite-jsonschema/blob/main/src/jsonschema.rs#L41 is (re-) taking ownership of memory that belongs to sqlite.

I haven't tested it but at first glance this seems rather off. Does that make sense? If so, happy to send you a patch. Let me know what you think.

Best,
Sebastian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions