Unverified Commit 0ca079ab authored by Ian Craggs's avatar Ian Craggs Committed by GitHub

Merge pull request #478 from lt-holman/segfault_fix

prevent segfault for unknown protocol in test app
parents 8a0daa17 9bd6c09d
......@@ -1319,7 +1319,14 @@ int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions* options)
}
if (options->struct_version < 2 || options->serverURIcount == 0)
{
if ( !m )
{
rc = MQTTCLIENT_NULL_PARAMETER;
goto exit;
}
rc = MQTTClient_connectURI(handle, options, m->serverURI);
}
else
{
int i;
......@@ -1354,7 +1361,7 @@ int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions* options)
}
exit:
if (m->c->will)
if (m && m->c && m->c->will)
{
if (m->c->will->payload)
free(m->c->will->payload);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment