I'm getting values of my config file with rapidXML in a kindly bad way.
xml_document<> doc;
doc.parse<parse_full>(buffer);
int a = atoi(doc.first_node("master")->first_node("profile")->first_node("width")->value());
If the node doesn't exist "first_node" return 0 so "->value()" crash. Returning a new xml_node will fix the crash but what about the memory leaks?
This is the rapidXML's fonction with the old and new return :
    xml_node<Ch> *first_node(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const
    {
        if (name)
        {
            if (name_size == 0)
                name_size = internal::measure(name);
            for (xml_node<Ch> *child = m_first_node; child; child = child->next_sibling())
                if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive))
                    return child;
            return new xml_node<Ch>(node_document);
            //return 0;
        }
        else
            return m_first_node;
    }
 
     
     
    