mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
fix(Cursor): fix a memory leak detected by valgrind
This commit is contained in:
@@ -96,13 +96,14 @@ void ffGenerateCursorJsonResult(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson
|
||||
|
||||
if (result.error.length)
|
||||
{
|
||||
yyjson_mut_obj_add_str(doc, module, "error", result.error.chars);
|
||||
return;
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "error", &result.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "theme", &result.theme);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "size", &result.size);
|
||||
}
|
||||
|
||||
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "theme", &result.theme);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "size", &result.size);
|
||||
|
||||
ffStrbufDestroy(&result.error);
|
||||
ffStrbufDestroy(&result.theme);
|
||||
|
||||
Reference in New Issue
Block a user