summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-07-26 13:13:49 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-07-26 13:13:49 +0000
commit1bf524b03f77f0af0d01c0b525e43db20eb6fddb (patch)
tree4678f2484d09af4e0cd8ffff908cbcfc06a81c66
parentb08787ecd10aeef88a909e2c43a99846f2e933e5 (diff)
downloadlasso-1bf524b03f77f0af0d01c0b525e43db20eb6fddb.tar.gz
lasso-1bf524b03f77f0af0d01c0b525e43db20eb6fddb.tar.xz
lasso-1bf524b03f77f0af0d01c0b525e43db20eb6fddb.zip
set a few variables to NULL after they'be freed; and don't free providerID in
lasso_user_get_authentication_method if it was passed by the caller.
-rw-r--r--lasso/id-ff/user.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lasso/id-ff/user.c b/lasso/id-ff/user.c
index 030acc13..1624503b 100644
--- a/lasso/id-ff/user.c
+++ b/lasso/id-ff/user.c
@@ -212,6 +212,8 @@ lasso_user_get_assertion(LassoUser *user,
assertion = (LassoNode *)g_hash_table_lookup(user->assertions,
remote_providerID);
+ if (assertion == NULL)
+ return NULL;
return(lasso_node_copy(assertion));
}
@@ -229,7 +231,9 @@ lasso_user_get_authentication_method(LassoUser *user,
providerID = lasso_user_get_next_assertion_remote_providerID(user);
}
assertion = lasso_user_get_assertion(user, providerID);
- g_free(providerID);
+ if (remote_providerID == NULL) {
+ g_free(providerID);
+ }
as = lasso_node_get_child(assertion, "AuthenticationStatement", NULL);
authentication_method = lasso_node_get_attr_value(as, "AuthenticationMethod", &err);
if (authentication_method == NULL) {
@@ -369,17 +373,23 @@ lasso_user_finalize(LassoUser *user)
/* free allocated memory for assertion_providerIDs array */
for (i=0; i<user->assertion_providerIDs->len; i++) {
g_free(user->assertion_providerIDs->pdata[i]);
+ user->assertion_providerIDs->pdata[i] = NULL;
}
g_ptr_array_free(user->assertion_providerIDs, TRUE);
+ user->assertion_providerIDs = NULL;
/* free allocated memory for identity_providerIDs array */
for (i=0; i<user->identity_providerIDs->len; i++) {
g_free(user->identity_providerIDs->pdata[i]);
+ user->identity_providerIDs->pdata[i] = NULL;
}
g_ptr_array_free(user->identity_providerIDs, TRUE);
+ user->identity_providerIDs = NULL;
g_hash_table_destroy(user->assertions);
+ user->assertions = NULL;
g_hash_table_destroy(user->identities);
+ user->identities = NULL;
parent_class->finalize(G_OBJECT(user));
}