mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 07:28:13 +08:00
Fix leak in unit test
This commit is contained in:
parent
f552d15fe4
commit
377d6acc74
@ -530,10 +530,9 @@ static void test_mqtt_ver(uint8_t mqtt_version) {
|
|||||||
struct mg_mqtt_prop properties[5];
|
struct mg_mqtt_prop properties[5];
|
||||||
const char *url = "mqtt://broker.hivemq.com:1883";
|
const char *url = "mqtt://broker.hivemq.com:1883";
|
||||||
int i, retries;
|
int i, retries;
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
|
|
||||||
// Connect with empty client ID, no options, ergo no MQTT != 3.1.1
|
// Connect with empty client ID, no options, ergo no MQTT != 3.1.1
|
||||||
if (mqtt_version != 4) goto connect_with_options;
|
mg_mgr_init(&mgr);
|
||||||
c = mg_mqtt_connect(&mgr, url, NULL, mqtt_cb, &test_data);
|
c = mg_mqtt_connect(&mgr, url, NULL, mqtt_cb, &test_data);
|
||||||
for (i = 0; i < 300 && mbuf[0] == 0; i++) mg_mgr_poll(&mgr, 10);
|
for (i = 0; i < 300 && mbuf[0] == 0; i++) mg_mgr_poll(&mgr, 10);
|
||||||
if (mbuf[0] != 'X') MG_INFO(("[%s]", mbuf));
|
if (mbuf[0] != 'X') MG_INFO(("[%s]", mbuf));
|
||||||
@ -578,7 +577,6 @@ static void test_mqtt_ver(uint8_t mqtt_version) {
|
|||||||
mg_mgr_free(&mgr);
|
mg_mgr_free(&mgr);
|
||||||
ASSERT(mgr.conns == NULL);
|
ASSERT(mgr.conns == NULL);
|
||||||
|
|
||||||
connect_with_options:
|
|
||||||
// (Re-)connect with options: version, clean session, last will, keepalive
|
// (Re-)connect with options: version, clean session, last will, keepalive
|
||||||
// time. Don't set retain, some runners are not random
|
// time. Don't set retain, some runners are not random
|
||||||
test_data.flags = 0;
|
test_data.flags = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user