update examples

This commit is contained in:
Sergio R. Caprile committed 2025-06-24 16:26:31 -03:00
1 parent 074ef5197b
commit f5e2c68c8b
27 files changed
+166 -47

No files matched your search

+3 -3
View File
@@ -26,9 +26,9 @@ void app_main(void) {
char *ssid = mg_json_get_str(json, "$.ssid");
char *pass = mg_json_get_str(json, "$.pass");
while (!wifi_init(ssid, pass)) (void) 0;
free(ssid);
free(pass);
free((void *) json.buf);
mg_free(ssid);
mg_free(pass);
mg_free((void *) json.buf);
} else {
// If WiFi is not configured, run CLI until configured
MG_INFO(("WiFi is not configured, running CLI. Press enter"));
+2 -2
View File
@@ -157,7 +157,7 @@ static void timer_fn(void *param) {
static void update_string(struct mg_str json, const char *path, char **value) {
char *jval;
if ((jval = mg_json_get_str(json, path)) != NULL) {
free(*value);
mg_free(*value);
*value = strdup(jval);
}
}
@@ -189,7 +189,7 @@ void uart_bridge_fn(struct mg_connection *c, int ev, void *ev_data) {
if (ev == MG_EV_OPEN && c->is_listening) {
struct mg_str config = mg_file_read(&mg_fs_posix, "config.json");
if (config.buf != NULL) config_apply(config);
free(config.buf);
mg_free(config.buf);
s_state.tcp.url = strdup(DEFAULT_TCP);
s_state.websocket.url = strdup(DEFAULT_WEBSOCKET);
s_state.mqtt.url = strdup(DEFAULT_MQTT);