diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-06-30 12:39:29 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-06-30 16:50:11 +0200 |
commit | 76c0a05f28531bcab3f89a4dfccae4b9b8eaf72c (patch) | |
tree | c540bc8bee0b3d396cc7955fe24385f24f3cfefa /src | |
parent | 608709f6206eb4061a6d59eff68babd3a8562129 (diff) |
#980 Fix memleak in og_cmd_scope_get
If either root or children_root fail to be created but the other one does not,
then reserved memory for the successful one would not be freed.
Diffstat (limited to 'src')
-rw-r--r-- | src/rest.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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); |