summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/rest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rest.c b/src/rest.c
index 43871e4..2a90028 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -2445,9 +2445,14 @@ static int og_cmd_scope_get(json_t *element, struct og_msg_params *params,
};
root = json_object();
+ if (!root)
+ return -1;
+
children_root = json_array();
- if (!root || !children_root)
+ if (!children_root) {
+ json_decref(root);
return -1;
+ }
json_object_set(root, "scope", children_root);