From 5be786c804d36e9950598a01cf39f05574af2acc Mon Sep 17 00:00:00 2001 From: MetaDucky Date: Wed, 20 Nov 2013 22:11:57 +0100 Subject: Fixed potential NULL pointer and leak when setting node metadata --- src/map.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/map.h') 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); /* -- cgit v1.2.3