Skip to content

Need public API to free returned strings (e.g. cJSON_Print) #5

@ewmailing

Description

@ewmailing

There should be a public API to free returned strings like from cJSON_Print().

My usage case is that I'm writing a middleware library that uses cJSON. The user is free to use cJSON elsewhere in their project. I don't necessarily know what memory allocator they are using, so when I call cJSON_Print(), I don't know what free() function to call. cJSON_free is private/internal.

I'm thinking either adding a cJSON_FreeString() which wraps cJSON_free, or making CJSON_free public are the easiest solutions.

Thank you

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