summaryrefslogtreecommitdiff
path: root/src/map.h
diff options
context:
space:
mode:
authorMetaDucky <metaducky AT gmail DOT com>2013-11-20 22:11:57 +0100
committerkwolekr <kwolekr@minetest.net>2013-11-29 23:35:16 -0500
commit5be786c804d36e9950598a01cf39f05574af2acc (patch)
tree488f9fd610b5785389c15d0faa02f840ba9e7110 /src/map.h
parent747bc40840ff13bcf9c7a60b790a6de24f94f946 (diff)
downloadminetest-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.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/map.h b/src/map.h
index a6480c569..8e55af437 100644
--- a/src/map.h
+++ b/src/map.h
@@ -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);
/*