diff -up ./runtime/msg.c.orig ./runtime/msg.c --- a/runtime/msg.c 2015-01-15 19:30:02.351699869 +0100 +++ b/runtime/msg.c 2015-01-15 19:35:58.667176642 +0100 @@ -4267,22 +4267,19 @@ jsonPathFindParent(struct json_object *j RETiRet; } +/* In case of duplicate names, the original value is kept. */ static rsRetVal jsonMerge(struct json_object *existing, struct json_object *json) { - /* TODO: check & handle duplicate names */ DEFiRet; struct json_object_iter it; - json_object_object_foreachC(json, it) { - json_object_object_add(existing, it.key, - json_object_get(it.val)); + json_object_object_foreachC(existing, it) { + json_object_object_add(json, it.key, json_object_get(it.val)); } - /* note: json-c does ref counting. We added all descandants refcounts - * in the loop above. So when we now free(_put) the root object, only - * root gets freed(). - */ - json_object_put(json); + + iRet = jsonMerge(existing, json); + RETiRet; }