summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/database.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-03-27 01:32:14 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-03-27 01:32:14 +0200
commit5da9dd9fc2efb09fdd70fcac535146ee3dddd20d (patch)
tree44b5a934cb49c8c8a988be354ea9ce94ffa43f65 /crawl-ref/source/database.cc
parentf5498a422d4288fa12aee993a7410d37330c382a (diff)
downloadcrawl-ref-5da9dd9fc2efb09fdd70fcac535146ee3dddd20d.tar.gz
crawl-ref-5da9dd9fc2efb09fdd70fcac535146ee3dddd20d.zip
Fix an use-after-free potential crash.
That's inside multithreaded code, so it's worse than it looks.
Diffstat (limited to 'crawl-ref/source/database.cc')
-rw-r--r--crawl-ref/source/database.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc
index 1787f80bbd..abd47cfe74 100644
--- a/crawl-ref/source/database.cc
+++ b/crawl-ref/source/database.cc
@@ -253,8 +253,9 @@ bool TextDB::_needs_update() const
// No point in empty databases, although for simplicity keep ones
// for disappeared translations for now.
ASSERT(english);
- delete english->translation;
- english->translation = 0;
+ TextDB *en = english;
+ delete en->translation; // ie, ourself
+ en->translation = 0;
return false;
}