diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-10-23 08:02:22 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-10-23 08:02:22 +0000 |
commit | 8eda6c18fd391e34f180aaece96140a374f274f9 (patch) | |
tree | 9598ebf5280790951b30befe9c84d4bba57198e4 /src/configuration.cpp | |
parent | c9f618b5c50f759cf172d8e37063ef56e05812cf (diff) | |
download | mana-client-8eda6c18fd391e34f180aaece96140a374f274f9.tar.gz mana-client-8eda6c18fd391e34f180aaece96140a374f274f9.tar.bz2 mana-client-8eda6c18fd391e34f180aaece96140a374f274f9.tar.xz mana-client-8eda6c18fd391e34f180aaece96140a374f274f9.zip |
Merged changesets 3653, 3655-3657, 3659-3560, 3671-3672 from trunk to
0.0. Mostly memory leak fixes by Guillaume.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r-- | src/configuration.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index d33df386..864ad7c3 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -53,6 +53,7 @@ void Configuration::init(const std::string &filename) if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "configuration")) { logger->log("Warning: No configuration file (%s)", filename.c_str()); + xmlFreeDoc(doc); return; } @@ -61,15 +62,13 @@ void Configuration::init(const std::string &filename) if (!xmlStrEqual(node->name, BAD_CAST "option")) continue; - xmlChar *name = xmlGetProp(node, BAD_CAST "name"); - xmlChar *value = xmlGetProp(node, BAD_CAST "value"); + std::string name = XML::getProperty(node, "name", std::string()); + std::string value = XML::getProperty(node, "value", std::string()); - if (name && value) { - mOptions[(const char*)name] = (const char*)value; + if (!name.empty() && !value.empty()) + { + mOptions[name] = value; } - - if (name) xmlFree(name); - if (value) xmlFree(value); } xmlFreeDoc(doc); |