if (!jgroup)
return false;
- if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr))
+ if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr)) {
+ json_object_put(jgroup);
return false;
+ }
json_object_array_add(jgroups, jgroup);
if (!jgroup)
return false;
- if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr))
+ if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr)) {
+ json_object_put(jgroup);
return false;
+ }
json_object_array_add(jgroups, jgroup);