fix memory leak in NodeValue
This commit is contained in:
parent
3b049ec0e4
commit
b2d9990334
|
@ -5,12 +5,13 @@
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class ValueNode: public Node
|
class ValueNode: public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ValueNode(void){node_type = VALUE_NODE;value = "empty";};
|
ValueNode(void){node_type = VALUE_NODE;value = "empty";};
|
||||||
int node_type;
|
int node_type;
|
||||||
const char* value; //tra due tag
|
string value; //tra due tag
|
||||||
virtual void printNode();
|
virtual void printNode();
|
||||||
virtual int qualifyNode();
|
virtual int qualifyNode();
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ void XMLTree::finalizeMain()
|
||||||
|
|
||||||
void XMLTree::addHeaders(const char* str, const char*val)
|
void XMLTree::addHeaders(const char* str, const char*val)
|
||||||
{
|
{
|
||||||
MainNode* mn = (MainNode*) root.Sons.front();
|
MainNode* mn = dynamic_cast<MainNode *>(root.Sons.front());
|
||||||
mn->headers.push_back(pair<const char*,const char*>(str,val));
|
mn->headers.push_back(pair<const char*,const char*>(str,val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,6 @@ void XMLTree::addClasses(ClassNode* cn)
|
||||||
|
|
||||||
void XMLTree::addNode(const char* s, int value_type, const char* name)
|
void XMLTree::addNode(const char* s, int value_type, const char* name)
|
||||||
{
|
{
|
||||||
|
|
||||||
ValueNode* vn = new ValueNode;
|
ValueNode* vn = new ValueNode;
|
||||||
EntryNode* en = new EntryNode;
|
EntryNode* en = new EntryNode;
|
||||||
OwnSlotNode* osn = new OwnSlotNode;
|
OwnSlotNode* osn = new OwnSlotNode;
|
||||||
|
@ -275,7 +274,7 @@ void XMLTree::printXMLTree()
|
||||||
osn = dynamic_cast<OwnSlotNode *>(*it3);
|
osn = dynamic_cast<OwnSlotNode *>(*it3);
|
||||||
fprintf(fp,"\t\t\t<own-slot slot-name=\":%s\">\n",osn->name);
|
fprintf(fp,"\t\t\t<own-slot slot-name=\":%s\">\n",osn->name);
|
||||||
fprintf(fp,"\t\t\t\t<entry type=\"%s\">\n",osn->entry.type);
|
fprintf(fp,"\t\t\t\t<entry type=\"%s\">\n",osn->entry.type);
|
||||||
fprintf(fp,"\t\t\t\t\t<value>%s", osn->entry.value.value);
|
fprintf(fp,"\t\t\t\t\t<value>%s", osn->entry.value.value.c_str());
|
||||||
fprintf(fp,"</value>\n");
|
fprintf(fp,"</value>\n");
|
||||||
fprintf(fp,"\t\t\t\t</entry>\n");
|
fprintf(fp,"\t\t\t\t</entry>\n");
|
||||||
fprintf(fp,"\t\t\t</own-slot>\n");
|
fprintf(fp,"\t\t\t</own-slot>\n");
|
||||||
|
@ -302,7 +301,7 @@ void XMLTree::printXMLTree()
|
||||||
osn = dynamic_cast<OwnSlotNode *>(*it3);
|
osn = dynamic_cast<OwnSlotNode *>(*it3);
|
||||||
fprintf(fp,"\t\t\t\t<own-slot slot-name=\":%s\">\n",osn->name);
|
fprintf(fp,"\t\t\t\t<own-slot slot-name=\":%s\">\n",osn->name);
|
||||||
fprintf(fp,"\t\t\t\t\t<entry type=\"%s\">\n",osn->entry.type);
|
fprintf(fp,"\t\t\t\t\t<entry type=\"%s\">\n",osn->entry.type);
|
||||||
fprintf(fp,"\t\t\t\t\t\t<value>%s", osn->entry.value.value);
|
fprintf(fp,"\t\t\t\t\t\t<value>%s", osn->entry.value.value.c_str());
|
||||||
fprintf(fp,"</value>\n");
|
fprintf(fp,"</value>\n");
|
||||||
fprintf(fp,"\t\t\t\t\t</entry>\n");
|
fprintf(fp,"\t\t\t\t\t</entry>\n");
|
||||||
fprintf(fp,"\t\t\t\t</own-slot>\n");
|
fprintf(fp,"\t\t\t\t</own-slot>\n");
|
||||||
|
@ -337,7 +336,7 @@ void XMLTree::printXMLTree()
|
||||||
osn = dynamic_cast<OwnSlotNode *>(*it3);
|
osn = dynamic_cast<OwnSlotNode *>(*it3);
|
||||||
fprintf(fp,"\t\t\t\t<own-slot slot-name=\":%s\">\n",osn->name);
|
fprintf(fp,"\t\t\t\t<own-slot slot-name=\":%s\">\n",osn->name);
|
||||||
fprintf(fp,"\t\t\t\t\t<entry type=\"%s\">\n",osn->entry.type);
|
fprintf(fp,"\t\t\t\t\t<entry type=\"%s\">\n",osn->entry.type);
|
||||||
fprintf(fp,"\t\t\t\t\t\t<value>%s", osn->entry.value.value);
|
fprintf(fp,"\t\t\t\t\t\t<value>%s", osn->entry.value.value.c_str());
|
||||||
fprintf(fp,"</value>\n");
|
fprintf(fp,"</value>\n");
|
||||||
fprintf(fp,"\t\t\t\t\t</entry>\n");
|
fprintf(fp,"\t\t\t\t\t</entry>\n");
|
||||||
fprintf(fp,"\t\t\t\t</own-slot>\n");
|
fprintf(fp,"\t\t\t\t</own-slot>\n");
|
||||||
|
|
Loading…
Reference in New Issue