better codez

master
Ondřej Hruška 9 years ago
parent b9885c8b1a
commit a8e85d256e
  1. 9
      user/cgi.c
  2. 2
      user/cgi.h
  3. 2
      user/user_main.c

@ -44,7 +44,10 @@ typedef struct {
int ICACHE_FLASH_ATTR tplMultipart(HttpdConnData *connData, char *token, void **arg) int ICACHE_FLASH_ATTR tplMultipart(HttpdConnData *connData, char *token, void **arg)
{ {
if (token == NULL) { if (token == NULL) {
if (*arg != NULL) free(*arg); if (*arg != NULL) {
free(*arg);
*arg = NULL; // mark as already freed
}
return HTTPD_CGI_DONE; // cleanup return HTTPD_CGI_DONE; // cleanup
} }
@ -81,6 +84,7 @@ int ICACHE_FLASH_ATTR tplMultipart(HttpdConnData *connData, char *token, void **
if (rns->count_remain == 0) { if (rns->count_remain == 0) {
free(rns); free(rns);
*arg = NULL; // mark as already freed
return HTTPD_CGI_DONE; return HTTPD_CGI_DONE;
} }
@ -90,7 +94,7 @@ int ICACHE_FLASH_ATTR tplMultipart(HttpdConnData *connData, char *token, void **
return HTTPD_CGI_DONE; return HTTPD_CGI_DONE;
} }
/*
// better to put it in the fs... // better to put it in the fs...
int FLASH_FN cgiRandomNumbers(HttpdConnData *connData) { int FLASH_FN cgiRandomNumbers(HttpdConnData *connData) {
@ -161,3 +165,4 @@ int FLASH_FN cgiRandomNumbers(HttpdConnData *connData) {
return HTTPD_CGI_MORE; return HTTPD_CGI_MORE;
} }
*/

@ -6,7 +6,7 @@
int tplCounter(HttpdConnData *connData, char *token, void **arg); int tplCounter(HttpdConnData *connData, char *token, void **arg);
int cgiRandomNumbers(HttpdConnData *connData); //int cgiRandomNumbers(HttpdConnData *connData);
int tplMultipart(HttpdConnData *connData, char *token, void **arg); int tplMultipart(HttpdConnData *connData, char *token, void **arg);

@ -113,7 +113,7 @@ static HttpdBuiltInUrl builtInUrls[] = {
{"/multipart.tpl", cgiEspFsTemplate, (void *)tplMultipart}, {"/multipart.tpl", cgiEspFsTemplate, (void *)tplMultipart},
{"/random.tpl", cgiRandomNumbers, NULL}, // {"/random.tpl", cgiRandomNumbers, NULL},
//Enable the line below to protect the WiFi configuration with an username/password combo. //Enable the line below to protect the WiFi configuration with an username/password combo.
// {"/wifi/*", authBasic, (void *)myPassFn}, // {"/wifi/*", authBasic, (void *)myPassFn},

Loading…
Cancel
Save