summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/store.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-10 03:10:00 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-10 03:11:44 -0800
commiteba5fc84b75c7dde072f1ba49a56f5e7913b8eb7 (patch)
tree7530361adfb726edbfca62259cc09d6610bd7ca7 /crawl-ref/source/store.cc
parent1569a7ec6ccfc1d9aafe1a92c70bba132adf6bf7 (diff)
downloadcrawl-ref-eba5fc84b75c7dde072f1ba49a56f5e7913b8eb7.tar.gz
crawl-ref-eba5fc84b75c7dde072f1ba49a56f5e7913b8eb7.zip
CrawlHashTable: free memory on assignment
Free a CrawlHashTable's used memory when it's clobbered via being assigned to.
Diffstat (limited to 'crawl-ref/source/store.cc')
-rw-r--r--crawl-ref/source/store.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/crawl-ref/source/store.cc b/crawl-ref/source/store.cc
index 97d1e0a8c1..25c50ed763 100644
--- a/crawl-ref/source/store.cc
+++ b/crawl-ref/source/store.cc
@@ -1154,7 +1154,7 @@ CrawlHashTable::CrawlHashTable(const CrawlHashTable& other)
CrawlHashTable::~CrawlHashTable()
{
- // NOTE: Not using std::auto_ptr because making hash_map and auto_ptr
+ // NOTE: Not using std::auto_ptr because making hash_map an auto_ptr
// causes compile weirdness in externs.h
if (hash_map == NULL)
return;
@@ -1165,6 +1165,9 @@ CrawlHashTable::~CrawlHashTable()
CrawlHashTable &CrawlHashTable::operator = (const CrawlHashTable &other)
{
+ if (hash_map != NULL)
+ delete hash_map;
+
if (other.hash_map == NULL)
{
hash_map = NULL;