summaryrefslogtreecommitdiffstats
path: root/lasso/xml
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-02-04 00:02:07 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-02-04 00:02:07 +0000
commitb780bd237604c80ffd5c483d2ab231ed0e328bee (patch)
tree550fdb59142da450a3273936e35dd6e857238ac0 /lasso/xml
parent7aa18e07b1f0395e363eb0e65beb6d74ffd4f473 (diff)
Fix leaks
* lasso/id-wsf-2.0/profile.c: release private data object. * lasso/saml-2.0/login.c: free NameID content after construction. * lasso/xml/tools.c: free algorithm attribute content in lasso_node_decrypt_xmlnode. * lasso/xml/xml.c: release cutom_element->nodename in destructor. remove useless finalize method. * tests/basic_tests.c: release xmldoc after use. * tests/random_tests.c: free resut of lasso_node_dump.
Diffstat (limited to 'lasso/xml')
-rw-r--r--lasso/xml/tools.c9
-rw-r--r--lasso/xml/xml.c8
2 files changed, 6 insertions, 11 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
index 66b5ec69..68001b60 100644
--- a/lasso/xml/tools.c
+++ b/lasso/xml/tools.c
@@ -1338,7 +1338,7 @@ lasso_node_decrypt_xmlnode(xmlNode* encrypted_element,
xmlNodePtr encrypted_data_node = NULL;
xmlNodePtr encrypted_key_node = NULL;
xmlNodePtr encryption_method_node = NULL;
- char *algorithm = NULL;
+ xmlChar *algorithm = NULL;
xmlSecKeyDataId key_type;
GList *i = NULL;
int rc = LASSO_DS_ERROR_DECRYPTION_FAILED;
@@ -1360,14 +1360,14 @@ lasso_node_decrypt_xmlnode(xmlNode* encrypted_element,
message(G_LOG_LEVEL_WARNING, "No EncryptionMethod node in EncryptedData");
goto cleanup;
}
- algorithm = (char*)xmlGetProp(encryption_method_node, (xmlChar *)"Algorithm");
+ algorithm = xmlGetProp(encryption_method_node, (xmlChar *)"Algorithm");
if (algorithm == NULL) {
message(G_LOG_LEVEL_WARNING, "No EncryptionMethod");
goto cleanup;
}
- if (strstr(algorithm , "#aes")) {
+ if (strstr((char*)algorithm , "#aes")) {
key_type = xmlSecKeyDataAesId;
- } else if (strstr(algorithm , "des")) {
+ } else if (strstr((char*)algorithm , "des")) {
key_type = xmlSecKeyDataDesId;
} else {
message(G_LOG_LEVEL_WARNING, "Unknown EncryptionMethod");
@@ -1470,6 +1470,7 @@ cleanup:
lasso_release_doc(doc);
lasso_release_doc(doc2);
lasso_release_gobject(decrypted_node);
+ lasso_release_xml_string(algorithm);
return rc;
}
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index ce84c680..f9d3a233 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -825,6 +825,7 @@ _lasso_node_free_custom_element(struct _CustomElement *custom_element)
{
lasso_release_string(custom_element->prefix);
lasso_release_string(custom_element->href);
+ lasso_release_string(custom_element->nodename);
lasso_release(custom_element);
}
@@ -1476,12 +1477,6 @@ lasso_node_dispose(GObject *object)
parent_class->dispose(object);
}
-static void
-lasso_node_finalize(GObject *object)
-{
- parent_class->finalize(object);
-}
-
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
@@ -1509,7 +1504,6 @@ class_init(LassoNodeClass *class)
/* override */
gobject_class->dispose = lasso_node_dispose;
- gobject_class->finalize = lasso_node_finalize;
original_xmlnode_quark = g_quark_from_static_string("lasso_original_xmlnode");
custom_element_quark = g_quark_from_static_string("lasso_custom_element");