1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fixed potential NULL pointer and leak when setting node metadata

This commit is contained in:
MetaDucky 2013-11-20 22:11:57 +01:00 committed by kwolekr
parent 747bc40840
commit 5be786c804
5 changed files with 56 additions and 19 deletions

View file

@ -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);