lua-users home
lua-l archive

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



I stumbled upon such an error message, on OS X:

lua51(4112) malloc: *** Deallocation of a pointer not malloced: 0x56fc0;
  This could be a double free(), or free() called with the middle of an
allocated block; Try setting environment variable MallocHelp to see tools to
  help debug

Getting one of these per each sandboxed call I do -- part of deserialization code.

If I apply no sandboxing (comment out the lines below) there is no problems.

WHAT is going on, and WHAT am I not seeing?

I thought it's the -2 index, but does the same with absolute stack index, too.

...
// [1]: function to return deserialized data

// Without this, 'os.execute' etc. would be available to the deserialized script!
//
//lua_newtable( L );
//rr= lua_setfenv( L, -2 );
//fprintf( stderr, "[[%d]]", rr );   // gives 1 (all should be okay?)

lua_call( L, 0 /*args*/, LUA_MULTRET );

^--- something within that call is what gives the dual-free warning

Thanks! :)

-asko