JSON format: fix some memleaks

This commit is contained in:
李通洲
2023-09-08 20:03:26 +08:00
parent d97b16950c
commit 1cdc99f327
4 changed files with 9 additions and 3 deletions
+3
View File
@@ -162,4 +162,7 @@ void ffGenerateCPUJson(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_va
else
yyjson_mut_obj_add_null(doc, obj, "temperature");
}
ffStrbufDestroy(&cpu.name);
ffStrbufDestroy(&cpu.vendor);
}
+4
View File
@@ -106,4 +106,8 @@ void ffGenerateCursorJson(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson_mut_d
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);
ffStrbufDestroy(&result.size);
}
+1 -1
View File
@@ -199,6 +199,7 @@ void ffGenerateDisplayJson(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjson_mut
FF_LIST_FOR_EACH(FFDisplayResult, item, dsResult->displays)
{
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
yyjson_mut_obj_add_uint(doc, obj, "width", item->width);
yyjson_mut_obj_add_uint(doc, obj, "height", item->height);
yyjson_mut_obj_add_uint(doc, obj, "id", item->id);
yyjson_mut_obj_add_strbuf(doc, obj, "name", &item->name);
@@ -219,6 +220,5 @@ void ffGenerateDisplayJson(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjson_mut
yyjson_mut_obj_add_str(doc, obj, "type", "Unknown");
break;
}
yyjson_mut_obj_add_uint(doc, obj, "scaledWidth", item->width);
}
}