here is the C function I want to call:
char* decrypt(const char* str, int len) {
char* endata = malloc(len/2);
//assign
return endata;
}
here is lua content:
local ffi = require "ffi"
local rsa = ffi.load("test.so")
ffi.cdef[[
char* decrypt(const char* str, int len);
]]
local str = "256b5740ed16e5b15146816f77b0ab74de43d58ab367e9ac850642514f5cc4880e899a6a7775aa"
local c_str = test.decrypt(str, 256)
local lua_str = ffi.string(c_str, 128)
would luajit free c_str automaticly?
would luajit free c_str automaticly?
No, it would not. LuaJIT knows nothing what this pointer is.