mirror of https://git.48k.eu/ogserver
#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.master
parent
608709f620
commit
76c0a05f28
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue