MXS-2721: Check that LocalClient creation succeeds
The creation can fail if a network socket cannot be opened and connected to the host in question.
This commit is contained in:

committed by
Johan Wikman

parent
cf8ff493bc
commit
64cae223f0
@ -1438,13 +1438,15 @@ static void worker_func(int thread_id, void* data)
|
|||||||
for (TargetList::iterator it = info->targets.begin();
|
for (TargetList::iterator it = info->targets.begin();
|
||||||
it != info->targets.end(); it++)
|
it != info->targets.end(); it++)
|
||||||
{
|
{
|
||||||
LocalClient* client = LocalClient::create(&info->session, &info->protocol, it->first);
|
if (LocalClient* client = LocalClient::create(&info->session, &info->protocol, it->first))
|
||||||
GWBUF* buffer = modutil_create_query(it->second.c_str());
|
{
|
||||||
client->queue_query(buffer);
|
GWBUF* buffer = modutil_create_query(it->second.c_str());
|
||||||
gwbuf_free(buffer);
|
client->queue_query(buffer);
|
||||||
|
gwbuf_free(buffer);
|
||||||
|
|
||||||
// The LocalClient needs to delete itself once the queries are done
|
// The LocalClient needs to delete itself once the queries are done
|
||||||
client->self_destruct();
|
client->self_destruct();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete info;
|
delete info;
|
||||||
|
Reference in New Issue
Block a user