mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-30 10:48:06 +02:00
Merge branch 'fix/calloc_failure' into 'master'
PR: Return on allocation failure See merge request espressif/esp-mqtt!204
This commit is contained in:
@ -761,7 +761,7 @@ mqtt_message_t *mqtt5_msg_publish(mqtt_connection_t *connection, const char *top
|
|||||||
char *response_topic = calloc(1, response_topic_size);
|
char *response_topic = calloc(1, response_topic_size);
|
||||||
if (!response_topic) {
|
if (!response_topic) {
|
||||||
ESP_LOGE(TAG, "Failed to calloc %d memory", response_topic_size);
|
ESP_LOGE(TAG, "Failed to calloc %d memory", response_topic_size);
|
||||||
fail_message(connection);
|
return fail_message(connection);
|
||||||
}
|
}
|
||||||
snprintf(response_topic, response_topic_size, "%s/%s", property->response_topic, resp_info);
|
snprintf(response_topic, response_topic_size, "%s/%s", property->response_topic, resp_info);
|
||||||
if (append_property(connection, MQTT5_PROPERTY_RESPONSE_TOPIC, 2, response_topic, response_topic_size) == -1) {
|
if (append_property(connection, MQTT5_PROPERTY_RESPONSE_TOPIC, 2, response_topic, response_topic_size) == -1) {
|
||||||
|
@ -1659,6 +1659,11 @@ static void esp_mqtt_task(void *pv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (last_retransmit == 0) {
|
||||||
|
// connected for first time, set last_retransmit to now, avoid retransmit
|
||||||
|
last_retransmit = platform_tick_get_ms();
|
||||||
|
}
|
||||||
|
|
||||||
// delete long pending messages
|
// delete long pending messages
|
||||||
mqtt_delete_expired_messages(client);
|
mqtt_delete_expired_messages(client);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user