mirror of https://github.com/eclipse/paho.mqtt.c
Set username and password fields to NULL if not used #1227
This commit is contained in:
parent
e72f39ffba
commit
f54f10ec10
|
|
@ -804,11 +804,17 @@ int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions* options)
|
|||
#endif
|
||||
|
||||
if (m->c->username)
|
||||
{
|
||||
free((void*)m->c->username);
|
||||
m->c->username = NULL;
|
||||
}
|
||||
if (options->username)
|
||||
m->c->username = MQTTStrdup(options->username);
|
||||
if (m->c->password)
|
||||
{
|
||||
free((void*)m->c->password);
|
||||
m->c->password = NULL;
|
||||
}
|
||||
if (options->password)
|
||||
{
|
||||
m->c->password = MQTTStrdup(options->password);
|
||||
|
|
|
|||
|
|
@ -1625,11 +1625,17 @@ static MQTTResponse MQTTClient_connectURI(MQTTClient handle, MQTTClient_connectO
|
|||
#endif
|
||||
|
||||
if (m->c->username)
|
||||
{
|
||||
free((void*)m->c->username);
|
||||
m->c->username = NULL;
|
||||
}
|
||||
if (options->username)
|
||||
m->c->username = MQTTStrdup(options->username);
|
||||
if (m->c->password)
|
||||
{
|
||||
free((void*)m->c->password);
|
||||
m->c->password = NULL;
|
||||
}
|
||||
if (options->password)
|
||||
{
|
||||
m->c->password = MQTTStrdup(options->password);
|
||||
|
|
|
|||
Loading…
Reference in New Issue