summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/map.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp index 6b83442..ef0d6c3 100644 --- a/src/map.cpp +++ b/src/map.cpp
@@ -44,8 +44,14 @@ Map::Map(const std::string name)
44 if (!xmlStrcmp(node->name, (const xmlChar*) "name")) 44 if (!xmlStrcmp(node->name, (const xmlChar*) "name"))
45 { 45 {
46 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); 46 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
47 title = (char*) calloc(xmlStrlen(key) + 1, sizeof(char)); 47 int len = xmlStrlen(key);
48 strcpy(title, (char*) key); 48 title = (char*) calloc(len + 1, sizeof(char));
49
50 if (len > 0)
51 {
52 strcpy(title, (char*) key);
53 }
54
49 xmlFree(key); 55 xmlFree(key);
50 } else if (!xmlStrcmp(node->name, (const xmlChar*) "environment")) 56 } else if (!xmlStrcmp(node->name, (const xmlChar*) "environment"))
51 { 57 {