summaryrefslogtreecommitdiffstats
path: root/lasso/xml
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-12-15 19:02:40 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-12-15 19:02:40 +0000
commit2755b354980da87565835911b7aa3806e659061b (patch)
tree59f08d2f3a2e751a471a79f0162a294f5fb010fe /lasso/xml
parenta9e250aec10e9b29e1236880241755b6326dd04b (diff)
downloadlasso-2755b354980da87565835911b7aa3806e659061b.tar.gz
lasso-2755b354980da87565835911b7aa3806e659061b.tar.xz
lasso-2755b354980da87565835911b7aa3806e659061b.zip
memory management work
Diffstat (limited to 'lasso/xml')
-rw-r--r--lasso/xml/xml.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index de321842..3d4b991a 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -105,6 +105,10 @@ lasso_node_dump(LassoNode *node, const char *encoding, int format)
void
lasso_node_destroy(LassoNode *node)
{
+ if (node == NULL) {
+ message(G_LOG_LEVEL_CRITICAL, "lasso_node_destroy of NULL!!!");
+ return;
+ }
if (LASSO_IS_NODE(node)) {
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->destroy(node);
@@ -653,8 +657,10 @@ lasso_node_dispose(GObject *object)
fprintf(stderr, "freeing %s/%s (at %p)\n",
G_OBJECT_TYPE_NAME(object), snippet->name, *value);
#endif
- if (snippet->type & SNIPPET_NODE) {
- g_object_unref(*value);
+ if (snippet->type == SNIPPET_NODE ||
+ snippet->type == SNIPPET_NAME_IDENTIFIER ||
+ snippet->type == SNIPPET_NODE_IN_CHILD) {
+ lasso_node_destroy(*value);
} else {
g_free(*value);
}
@@ -848,7 +854,7 @@ lasso_node_new_from_xmlNode(xmlNode *xmlnode)
node = g_object_new(gtype, NULL);
rc = lasso_node_init_from_xml(node, xmlnode);
if (rc) {
- g_object_unref(node);
+ lasso_node_destroy(node);
return NULL;
}