{"action":"opened","issue":{"url":"https://api.github.com/repos/SmingHub/Sming/issues/1339","repository_url":"https://api.github.com/repos/SmingHub/Sming","labels_url":"https://api.github.com/repos/SmingHub/Sming/issues/1339/labels{/name}","comments_url":"https://api.github.com/repos/SmingHub/Sming/issues/1339/comments","events_url":"https://api.github.com/repos/SmingHub/Sming/issues/1339/events","html_url":"https://github.com/SmingHub/Sming/issues/1339","id":302078856,"number":1339,"title":"Memory Leak in member function downloadFile","user":{"login":"frankdownunder","id":5421796,"avatar_url":"https://avatars1.githubusercontent.com/u/5421796?v=4","gravatar_id":"","url":"https://api.github.com/users/frankdownunder","html_url":"https://github.com/frankdownunder","followers_url":"https://api.github.com/users/frankdownunder/followers","following_url":"https://api.github.com/users/frankdownunder/following{/other_user}","gists_url":"https://api.github.com/users/frankdownunder/gists{/gist_id}","starred_url":"https://api.github.com/users/frankdownunder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frankdownunder/subscriptions","organizations_url":"https://api.github.com/users/frankdownunder/orgs","repos_url":"https://api.github.com/users/frankdownunder/repos","events_url":"https://api.github.com/users/frankdownunder/events{/privacy}","received_events_url":"https://api.github.com/users/frankdownunder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-04T11:43:20Z","updated_at":"2018-03-04T11:43:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"When Wifi is unavailable,  the  downloadFile function of class HttpClient leaks\r\nThe following code has been lifted out of a normally working program.  On one occasion however, the Wifi was unavailable, and I noticed a memory leak as a result.\r\n\r\n`\r\n#include <user_config.h>\r\n#include <SmingCore/SmingCore.h>\r\n#ifndef WIFI_SSID\r\n#define WIFI_SSID\t\"XXXXX\" \r\n#define WIFI_PWD\t\"YYYYY\"\r\n#endif\r\nHttpClient downloadClient;\r\n\r\nvoid onTimer_checkDownloadNewFirmware();\r\nTimer procTimerCheckDownloadNewFirmware;\r\nvoid onTimer_printMem();\r\nTimer procTimerPrintMem;\r\nvoid init()\r\n{\r\n\tSerial.begin(921600);\r\n\tprocTimerPrintMem.initializeMs(1 * 1 * 1000, onTimer_printMem).start();\r\n\tprocTimerCheckDownloadNewFirmware.initializeMs(1 * 2 * 1000, \r\n             onTimer_checkDownloadNewFirmware).start();\r\n}\r\n\r\nvoid onTimer_checkDownloadNewFirmware()\r\n{\r\n\tdownloadClient.downloadFile(\"http://www.XXXXXX.com/buildVersion.json\",\r\n\t\t(RequestCompletedDelegate)([](HttpConnection& connection, bool success) -> int\r\n\t\t\t{\r\n\t\t\t\tif (success) {\r\n\t\t\t\t\tdebugf(\"buildVersion.json success\\n\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t)\r\n\t);\r\n}\r\nvoid onTimer_printMem()\r\n{\r\n\tSerial.println(String(\"FreeHeap: \") + system_get_free_heap_size());\r\n}\r\n`\r\n"}}
{"actor":{"display_login":"frankdownunder"}}