summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-11 21:47:48 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-11 21:47:48 +0000
commit58450cb2170ea7bab536961c7266cae8a9d295e9 (patch)
treecff9d12212172d03bec38db93c2cd6d0ace33aed
parent72afed308c5c0100033dad4c15e352968109d9f2 (diff)
Make sure we dont leak ram after loading files
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8587 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/configreader.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 06513253c..dd0cd226d 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -1406,6 +1406,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
if ((character_count++ < 2) && (ch == '\xFF' || ch == '\xFE'))
{
errorstream << "File " << filename << " cannot be read, as it is encoded in braindead UTF-16. Save your file as plain ASCII!" << std::endl;
+ delete conf;
return false;
}
@@ -1461,6 +1462,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
else
{
errorstream << "End of file after a \\, what did you want to escape?: " << filename << ":" << linenumber << std::endl;
+ delete conf;
return false;
}
}
@@ -1475,6 +1477,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
if (!in_quote)
{
errorstream << "Got another opening < when the first one wasn't closed: " << filename << ":" << linenumber << std::endl;
+ delete conf;
return false;
}
}
@@ -1483,6 +1486,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
if (in_quote)
{
errorstream << "We're in a quote but outside a tag, interesting. " << filename << ":" << linenumber << std::endl;
+ delete conf;
return false;
}
else
@@ -1534,13 +1538,17 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
*/
if (!this->ParseLine(target, line, linenumber, errorstream, pass))
+ {
+ delete conf;
return false;
+ }
line.clear();
}
else
{
errorstream << "Got a closing > when we weren't inside a tag: " << filename << ":" << linenumber << std::endl;
+ delete conf;
return false;
}
}
@@ -1554,6 +1562,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
is a newline missing from the end of the file: " << filename << ":" << linenumber << std::endl;
}
+ delete conf;
return true;
}