/** * Heap termination. */ void Heap_terminate(void) { Log(TRACE_MIN, -1, "Maximum heap use was %d bytes", state.max_size); if (state.current_size > 20) /* One log list is freed after this function is called */ { Log(LOG_ERROR, -1, "Some memory not freed at shutdown, possible memory leak"); HeapScan(LOG_ERROR); } }
void Heap_terminate() { Log(LOG_INFO, "Maximum heap use was %d bytes\n", state.max_size); if (state.current_size > 0) { Log(LOG_ERROR, Messages_get(106)); HeapScan(); } }
int main(int argc, char *argv[]) { HeapScan(); MQTTS_Publish* pack = malloc(sizeof(MQTTS_Publish)); pack->header.type = MQTTS_PUBLISH; pack->data = malloc(10); MQTTSPacket_free_packet((MQTTS_Header*)pack); Clients* client = malloc(sizeof(Clients)); client->cleansession = 1; client->clientID = "a"; client->keepAliveInterval = 15; /* MQTTSPacket_send_connect(client); */ /* 7:4:4:1:0:15:97 */ free(client); Heap_terminate(); return 0; }