Fixed small memory leak in the template routine. Thanks to Grooves for noticing.

pull/30/head
Jeroen Domburg 10 years ago
parent d088cddd70
commit 9847755cf4
  1. 1
      httpd/httpdespfs.c
  2. 9
      user/user_main.c

@ -179,6 +179,7 @@ int ICACHE_FLASH_ATTR cgiEspFsTemplate(HttpdConnData *connData) {
//We're done. //We're done.
((TplCallback)(connData->cgiArg))(connData, NULL, &tpd->tplArg); ((TplCallback)(connData->cgiArg))(connData, NULL, &tpd->tplArg);
espFsClose(tpd->file); espFsClose(tpd->file);
os_free(tpd);
return HTTPD_CGI_DONE; return HTTPD_CGI_DONE;
} else { } else {
//Ok, till next time. //Ok, till next time.

@ -75,6 +75,12 @@ HttpdBuiltInUrl builtInUrls[]={
}; };
static ETSTimer prHeapTimer;
static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) {
os_printf("Heap: %ld\n", (unsigned long)system_get_free_heap_size());
}
//Main routine. Initialize stdout, the I/O, filesystem and the webserver and we're done. //Main routine. Initialize stdout, the I/O, filesystem and the webserver and we're done.
void user_init(void) { void user_init(void) {
stdoutInit(); stdoutInit();
@ -84,5 +90,8 @@ void user_init(void) {
// where image is written in flash that is defined in Makefile. // where image is written in flash that is defined in Makefile.
espFsInit((void*)(0x40200000 + ESPFS_POS)); espFsInit((void*)(0x40200000 + ESPFS_POS));
httpdInit(builtInUrls, 80); httpdInit(builtInUrls, 80);
os_timer_disarm(&prHeapTimer);
os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL);
os_timer_arm(&prHeapTimer, 3000, 1);
os_printf("\nReady\n"); os_printf("\nReady\n");
} }

Loading…
Cancel
Save