Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions source/platform/common/data_model/wifi_dml_json_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,12 @@ static cJSON* merge_with_references(cJSON* base, cJSON* ref_node)
cJSON* existing = cJSON_GetObjectItem(base, child->string);

if (!existing) {
/* Key doesn't exist - add reference */
cJSON_AddItemReferenceToObject(base, child->string, child);
/* Deep copy instead of reference to avoid dangling child pointer
when follow_ref_if_any deletes $ref through the wrapper */
cJSON* copy = cJSON_Duplicate(child, 1);
if (copy) {
cJSON_AddItemToObject(base, child->string, copy);
}
Comment on lines +181 to +184
} else if (strcmp(child->string, "properties") == 0 &&
cJSON_IsObject(existing) && cJSON_IsObject(child)) {
/* Both have "properties" object - recursively merge them */
Expand Down
Loading