diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-05-22 22:29:15 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-05-22 22:29:15 +0200 |
commit | 8d172c077e41e08e3864615538c6b06f07f24d84 (patch) | |
tree | 573ed2fcda038776280ccdfdfd9be238252d10ab /src | |
parent | ecf7690813b936a1751281f4b4a5199aa1db02c8 (diff) |
m_mysql Fix crash on rehash when the database tags have been changed in the config
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 682f041ad..16c4485f3 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -435,13 +435,14 @@ void ModuleSQL::OnRehash(User* user) i->second->lock.Lock(); i->second->lock.Unlock(); // now remove all active queries to this DB - for(unsigned int j = qq.size() - 1; j >= 0; j--) + for (size_t j = qq.size(); j > 0; j--) { - if (qq[j].c == i->second) + size_t k = j - 1; + if (qq[k].c == i->second) { - qq[j].q->OnError(err); - delete qq[j].q; - qq.erase(qq.begin() + j); + qq[k].q->OnError(err); + delete qq[k].q; + qq.erase(qq.begin() + k); } } // finally, nuke the connection |