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/rollback_interface.cpp | |
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/rollback_interface.cpp')
-rw-r--r-- | src/rollback_interface.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rollback_interface.cpp b/src/rollback_interface.cpp index 70a9e9457..808b07fed 100644 --- a/src/rollback_interface.cpp +++ b/src/rollback_interface.cpp @@ -340,7 +340,13 @@ bool RollbackAction::applyRevert(Map *map, InventoryManager *imgr, IGameDef *gam if(n_old.meta != ""){ if(!meta){ meta = new NodeMetadata(gamedef); - map->setNodeMetadata(p, meta); + if(!map->setNodeMetadata(p, meta)){ + delete meta; + infostream<<"RollbackAction::applyRevert(): " + <<"setNodeMetadata failed at " + <<PP(p)<<" for "<<n_old.name<<std::endl; + return false; + } } std::istringstream is(n_old.meta, std::ios::binary); meta->deSerialize(is); |