MXS-1220: Fix memory leaks
Some of the JSON objects created in the diagnostic functions leaked memory.
This commit is contained in:

committed by
Markus Mäkelä

parent
ebc9e4bd3b
commit
bc3cfe0221
@ -860,7 +860,7 @@ static json_t* diagnostics(MXS_ROUTER *router)
|
||||
snprintf(pathbuf, sizeof(pathbuf), "%lu-%lu-%lu", session->gtid.domain,
|
||||
session->gtid.server_id, session->gtid.seq);
|
||||
json_object_set_new(client, "current_gtid", json_string(pathbuf));
|
||||
json_array_append(arr, client);
|
||||
json_array_append_new(arr, client);
|
||||
}
|
||||
spinlock_release(&router_inst->lock);
|
||||
|
||||
|
@ -1603,7 +1603,7 @@ static json_t* diagnostics(MXS_ROUTER *router)
|
||||
|
||||
json_object_set_new(slave, "mode", json_string(mode));
|
||||
|
||||
json_array_append(arr, slave);
|
||||
json_array_append_new(arr, slave);
|
||||
}
|
||||
spinlock_release(&router_inst->lock);
|
||||
|
||||
|
@ -155,7 +155,7 @@ json_t* HintRouter::diagnostics()
|
||||
{
|
||||
if (default_action_values[i].enum_value == (uint64_t)m_default_action)
|
||||
{
|
||||
json_array_append(arr, json_string(default_action_values[i].name));
|
||||
json_array_append_new(arr, json_string(default_action_values[i].name));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user