Skip to content

crash in c connector (tp.h) when building requests with no inital buffer #16

@IlyaM

Description

@IlyaM

See the example code below. If I don't use static buffer and instead rely on the library code to allocate it for me then the code crashes without extra call for tp_ensure():

#include "tp.h"

int main() {
    struct tp req;
    tp_init(&req, NULL, 0, tp_realloc, NULL);
    tp_ensure(&req, 100); /* if this line is commented out the the code crashes in call to tp_tuple */
    tp_select(&req, 0, 0, 0, 0);
    tp_tuple(&req);
    tp_sz(&req, "key");

    free(req.s);

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions