AP_Scripting: fixes for modified AP_ROMFS API

need to use AP_ROMFS::free()
This commit is contained in:
Andrew Tridgell 2019-10-23 20:58:01 +11:00
parent 2b6883ff03
commit 4f2c6566b9

View File

@ -334,7 +334,7 @@ void lua_scripts::run(void) {
// load the sandbox creation function
uint32_t sandbox_size;
char *sandbox_data = (char *)AP_ROMFS::find_decompress("sandbox.lua", sandbox_size);
const char *sandbox_data = (const char *)AP_ROMFS::find_decompress("sandbox.lua", sandbox_size);
if (sandbox_data == nullptr) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "Scripting: Could not find sandbox");
return;
@ -344,7 +344,7 @@ void lua_scripts::run(void) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "Scripting: Loading sandbox: %s", lua_tostring(L, -1));
return;
}
free(sandbox_data);
AP_ROMFS::free((const uint8_t *)sandbox_data);
// Scan the filesystem in an appropriate manner and autostart scripts
load_all_scripts_in_dir(L, SCRIPTING_DIRECTORY);