diff options
author | MetaDucky <metaducky AT gmail DOT com> | 2013-11-20 22:11:57 +0100 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-11-29 23:35:16 -0500 |
commit | 5be786c804d36e9950598a01cf39f05574af2acc (patch) | |
tree | 488f9fd610b5785389c15d0faa02f840ba9e7110 /src/map.h | |
parent | 747bc40840ff13bcf9c7a60b790a6de24f94f946 (diff) | |
download | minetest-5be786c804d36e9950598a01cf39f05574af2acc.tar.gz minetest-5be786c804d36e9950598a01cf39f05574af2acc.tar.bz2 minetest-5be786c804d36e9950598a01cf39f05574af2acc.zip |
Fixed potential NULL pointer and leak when setting node metadata
Diffstat (limited to 'src/map.h')
-rw-r--r-- | src/map.h | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -307,7 +307,22 @@ public: */ NodeMetadata* getNodeMetadata(v3s16 p); - void setNodeMetadata(v3s16 p, NodeMetadata *meta); + + /** + * Sets metadata for a node. + * This method sets the metadata for a given node. + * On success, it returns @c true and the object pointed to + * by @p meta is then managed by the system and should + * not be deleted by the caller. + * + * In case of failure, the method returns @c false and the + * caller is still responsible for deleting the object! + * + * @param p node coordinates + * @param meta pointer to @c NodeMetadata object + * @return @c true on success, false on failure + */ + bool setNodeMetadata(v3s16 p, NodeMetadata *meta); void removeNodeMetadata(v3s16 p); /* |