Skip to content

Leaks #30

@olebol

Description

@olebol

The whole library (maybe the json library) leaks. Might be related to the use of the libcurl library. Specifically, the leaks are occurring in the curl_slist_append function.

Tested as follows on linux:

try {
        openai::start();
        
        auto chat = openai::chat().create({
	        {"model", "gpt-4o-mini"},
	        {"messages",
		        {
			        {
				        {"role", "system"},
				        {"content", SYSTEM_PROMPT},
			        },
			        {
				        {"role", "user"},
				        {"content", query},
				        {"max_tokens", MAX_TOKENS},
			        },
		        }},
        });
        
        response = chat["choices"][0]["message"]["content"];
} catch (const exception &e) {
        cerr << "Error: " << e.what() << '\n';
        response = "I'm sorry, I'm having trouble processing your request.";
}
	
cout << response << endl;

But I've tried it with the example instead and it leaks as well.

Noticed through compiling with -g --fsanitize=true

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