lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

And ..

char * getFile()
   char *buffer;
     FILE *f;
   //bla bla
   fread((char *)buffer,lengthoffile,1);
   return buffer;

Use this function in c

 char *buffer;
 buffer = getFile();

//Do something with the buffer


//be happy

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 ?