From 83eeca258621fe6efe14d0e5a1da432d8261be2f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 23 Oct 2019 20:58:01 +1100 Subject: [PATCH] AP_Scripting: fixes for modified AP_ROMFS API need to use AP_ROMFS::free() --- libraries/AP_Scripting/lua_scripts.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Scripting/lua_scripts.cpp b/libraries/AP_Scripting/lua_scripts.cpp index 7bb3b0e92a..ca4d24ffc0 100644 --- a/libraries/AP_Scripting/lua_scripts.cpp +++ b/libraries/AP_Scripting/lua_scripts.cpp @@ -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);