diff --git a/src/rest.c b/src/rest.c index 43871e4..2a90028 100644 --- a/src/rest.c +++ b/src/rest.c @@ -2445,10 +2445,15 @@ static int og_cmd_scope_get(json_t *element, struct og_msg_params *params, }; root = json_object(); - children_root = json_array(); - if (!root || !children_root) + if (!root) return -1; + children_root = json_array(); + if (!children_root) { + json_decref(root); + return -1; + } + json_object_set(root, "scope", children_root); dbi = og_dbi_open(&dbi_config);