|
Fabian Peña wrote:
please see this C code const char * getSome() { return strdup("some string"); } tolua generated code static int tolua_getSome(lua_State* tolua_S) { // bla bla bla const char* tolua_ret = (const char*) getSome(); tolua_pushstring(tolua_S,(const char*)tolua_ret); return 1; } Tthat it happens to the memory assigned in strdup? Memory Leak ?
Aren't you responsible for freeing the string returned by strdup() ? The following change would avoid the leak: const char * getSome() { return "some string"; } But I assume you can't do that for some reason, or you would not be asking. Brian