Skip to content

Commit

Permalink
forgot to free used memory
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorYbema committed Jan 18, 2025
1 parent 09a7424 commit b72179f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions HeishaMon/HeishaMon.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1767,9 +1767,13 @@ void loop() {
} else {
ethernetStat = F("not installed");
}
sprintf_P(log_msg, PSTR("{\"data\": {\"stats\": {\"wifi\": %d, \"ethernet\": \"%s\", \"memory\": %d, \"correct\": %.0f,\"mqtt\": %d,\"uptime\": \"%s\"}}}"), getWifiQuality(), ethernetStat.c_str(), getFreeMemory(), readpercentage, mqttReconnects, getUptime());
char *getuptime = getUptime();
sprintf_P(log_msg, PSTR("{\"data\": {\"stats\": {\"wifi\": %d, \"ethernet\": \"%s\", \"memory\": %d, \"correct\": %.0f,\"mqtt\": %d,\"uptime\": \"%s\"}}}"), getWifiQuality(), ethernetStat.c_str(), getFreeMemory(), readpercentage, mqttReconnects, getuptime);
free(getuptime);
#else
sprintf_P(log_msg, PSTR("{\"data\": {\"stats\": {\"wifi\": %d, \"memory\": %d, \"correct\": %.0f,\"mqtt\": %d,\"uptime\": \"%s\"}}}"), getWifiQuality(), getFreeMemory(), readpercentage, mqttReconnects, getUptime());
char *getuptime = getUptime();
sprintf_P(log_msg, PSTR("{\"data\": {\"stats\": {\"wifi\": %d, \"memory\": %d, \"correct\": %.0f,\"mqtt\": %d,\"uptime\": \"%s\"}}}"), getWifiQuality(), getFreeMemory(), readpercentage, mqttReconnects, getuptime);
free(getuptime);
#endif

websocket_write_all(log_msg, strlen(log_msg));
Expand Down

0 comments on commit b72179f

Please sign in to comment.