fixed potential NULLptr problems and leaked objects when setting node metadata

When a mapblock cannot be emerged, a given NodeMetadata object will never be deleted because it is not added to a mapblock's metadata list, which takes care of the deletion at some point. Due to this, also the Lua related getmeta() may fail even with auto_create.

It may be a bit unstylish to fix this thorugh a setter with a return value, but I can't see a way which doesn't involve larger refactoring, involving callers which currently still have the object reference and doing things with it...(so the setter cannot just delete the object in case of failure), so I hope this will do - comments added, to point this out.